Handling images (documents, and files) in Drupal

March 17th, 2007

I’ve been researching this for a while. Images and files as nodes don’t feel right to me. In Drupal I have come to think of a node as any page that has the intention of being displayed. A typical node has some text content, often with other embedded content like images or videos. A node is the destination. Images are things that belong embedded in a node and are not the destination itself.

Typically in the computer science realm a node is a data abstraction that hold any type or object. Some argue that therefore an image or file should be their own node. However, images and files are typically not the destination — they are merely parts that belong in a node. Compare that to a C++ node used in a linked list. A C++ node might contain a class. This class would contain some variables. The variables in that class are equivalent to images and files. The variables are not a node in that list.

I think files should be implemented similar to the method that comments are implemented in Drupal.

The following are notes that I’ve gathered supporting this.

Dries summer of code proposal

Improved file handling. Make it possible to mix database and file system storage on a per post basis, further abstract the storage model so we can support distributed storage solutions (like Amazon S3), apply node-level permissions to a node’s files through a light-weight file.php layer. Do not implement files as nodes.

from Mar 2006, Dev list

Drupalista

Why don´t you get together and produce ONE killer-img-module? Why are there 10 different modules for image uploading and handling?

Make ONE. Only ONE that works, please.

Stefan Nagtegaai

There are so much image related modules in contrib, which are mostly redundant in (a great part of) their functionality.. So I think [Drupalista] is right..

from Dec 2005, Dev list

Earl Miles

For people who write articles on my site, I find simplicity to be the absolutely most important issue. They want to be able to attach an image to a node and be done with it. If they have to set up an image node and then figure out how to link that image node to their article, they’re going to have a lot fewer articles with images.

James Walker

well “set up an image node” doesn’t / shouldn’t need to involve going to node/add/image and creating the image then going back to node/add/story, etc.

I.e. img assist (and htmlarea) both allow you to create image nodes when you attach. I’ve heard both that img_assist is sliced bread and that it’s still too confusing, not right, something…

Rowan Kerr

You could keep “nodes” and “files” separate…

Where nodes are any kind of actual content that is typed into the site And files are anything that is uploaded by the user

Then you’d have node types and file types.. that could decide just how to display different things.

nodes would be stuff like: blog, page, article, book page, etc… files would be stuff like: document, image, spreadsheet, movie, audio…

Because files that are uploaded, I would not really expect should be given a normal title, body, published/unpublished, etc… that nodes (actual content) would have. Really, node’s don’t have a filename, file size, mime type, filesystem path, etc…

Then you get into more of a document management system where things are clearly defined instead of combining content and external files under one container.

I think this is the way to go, three base types: user, node, file

Tim Altman: Don’t forget comments. :)

Dries Buytaert

1) All downloadable files should be nodes.

I disagree with this. If the sole purpose of the file is to be downloadable, there is no value in making it a node. It adds clutter and administration overhead.

Robert Douglass

Let’s say that the relationship is called “attached file”. The next step is to be able to search through all existing nodes that can possibly fill the roll of “attached file” while creating a new node. A current limitation of our system is that I’d have to upload the same PDF 3 times if I want to have it appear on 3 different nodes. This, we can all recognize, is crap. I should be able to reuse the already uploaded PDF. This raises two issues: a search interface for media assets is hard to build. Image assist is the best working example we have, and with all due respect to its greatness, it is still clunky (haven’t tried the newest version though).

on the fence / for nodes

There was lots more than this, but I only copied these.

Ber Kessels

This is a point of endless discussion in Drupal.

In myworld a node is a “thing” where all sorts of data meet. The node is nothing more then an entity to bind that data and make it a “thing”.

Unfortunately, in Drupal nodes are only used for content. For posts, to be more precisely. So over time drupaleers tend to think about a node as a post. Rather then the much more powerfull abstract “thing”it actually is.

So, in this a file would be nothing more then a “thing” of type “document”, “image” etc.

Sebastian wrote:

Frankly I feel all images should be a node. Even if an image is included in a content node just for spice or illustration, very likely these images could be thumbnails that link to a larger version. Same story if I include a true photo in a content node, it will most likely also be a thumbnail linking to the full image node. So I see no reason to build two frameworks for handling images when one will do. Why the arbitrary separation? They should all be nodes, and if we need organizational separation of “photos-available-in-galleries” vs “spice-and-illustration-images”, that should be handled via taxonomy, and only the desired terms made available in menus/galleries.

Summer of Code — Ideas for Drupal

March 8th, 2007

In no particular order, these are my current ideas for Drupal SOC projects. They are largely driven by what I want, please tell me if any would be useful for you.

Weather Module

This is the one module from Postnuke that I miss when using Drupal. Current options in Drupal do not include a full forecast. The Drupal Weather module does have individual location preferences, but the feature was not working properly when I installed it. SOC project would probably involve creating a new module using weather.com data.

Node conversion

A simple feature that I could use is a utility to convert node types. For example, when someone posts to the forum when it should be a flexinode/cck classified. Not sure what solving this problem would involve and not sure the scope is large enough for a SOC project.

Spreadsheet node

Complicated, but it could be very useful.

Snipshot integration

Snipshot is an online image editor. They have a spiffy api that allows full integration of their service into other websites. A snipshot module could be made to work with the Image module or Upload module for full online editing capability of images. Certainly many more details to be thought about, but could be a useful feature for some.

Amazon S3

Come up with a Drupal solution to serve all static content using Amazon S3 services. The files folder would be most important. Uploads would probably need to go to the local server and then later transfered to S3 via cron. Looks like there’s been some talk about doing this, but nothing implemented that I’m aware of.

Simple images

There is still no incredibly easy solution for images in Drupal. Many come close, but nothing that I would want on a large scale site for non-tech users. For example Facebook doesn’t use wyswyg, but they have a very simple positioning (screenshot here). It needs to be that simple. Blogger is also another great example.

There are many different directions this project could go — kkaefer already has a nice interface in his upload preview module. A filter for positioning could be added to that.

This project could also go the way of the Unified Document Project. There is something that bothers me about having files, folders, and even images as nodes though. Maybe more on that later.

The best input syntax is no syntax

March 7th, 2007

There are too many text markup/down/tile/wiki syntaxes out there and it’s a pain to relearn how to make bold text for every new website. Setting up a website is even worse since you need to decide what your users will likely be happy using. Markdown is a good choice. It’s pretty and simple, but it still has it’s problems. The casual user doesn’t realize a tab or ` will cause their text to pre-format and so they end up with messed up text. Sometimes people will forget a space when making a list and then they end up with a messed up list. The syntax was designed by a geek (perfectionist) and it shows when you have non-tech users.

My point is that a syntax should use what people already know and already do.[1] Two things you can assume people on the internet capable of posting comments know: that an address/url points to a website and what an email address is. Anything beyond pasting these two things and inputing plain text into a text box will probably require a good majority of internet users to learn something.

That is why I created Googtube — a text filter that converts links to Youtube and Google Videos into their embedded code. It’s the easiest possible way for anyone to embed a video into any website. Most of the time no instructions are necessary.

Googtube is currently available for Drupal, please port it or copy the regex for whatever platform you want. If you do this, I’d love to know.

If you see anyway Googtube could be exploited, let me know that too.

Notes

[1]: Ok, John Gruber did design it like this, but it only works sometimes. It’s a hard problem to fix. URL filters and email filters help a great deal.

Fixing RPI — Union Challenge #1

February 26th, 2007

My school’s student union is soliciting input from students by running a weekly essay challenge to win an engraved ipod.

The first question was:

“Describe the event, activity, or organization that is missing at RPI which would have the greatest impact on your out-of-the-classroom experience.”

I wrote:

I’m sitting here on a Friday night at 10pm trying to win an iPod. It’s not that I want an iPod; I already have one. It’s not that I like to write; I hate writing, that’s why I’m an engineer. It’s not even that I care much about improving the school; I’m outta here in May. The reason I’m writing is that it’s a competition and I could win something — win anything. Like many at RPI I came to this school as a big fish in a small pond. In high school I was a wizard of math, science and all things academic. Four years later, RPI has eroded my academic confidence with every new 42% I get back. Quite frankly I’m tired of not winning. That is why my suggestion to improve the out-of-classroom experience is to create an organization to generate non-academic competition. We all need a little ego boost sometimes.

Each week a new event could be put on, one week it could be foosball, another could be a taco eating competition and another bowling. Maybe even throw in a DDR competition for those special people at RPI. It would also be smart to include non-social competitions. Like drawing for example. That way we can all get involved without leaving our room or being forced to make eye contact with another human being.

I think you may have started something with this Union Challenge. Keep calling it the Union Challenge, just diversify to more random things. I would suggest keeping track of how many entries you receive and plotting the submission times. With this you could curve fit the data and extrapolate how many students would enter other competitions. Please do this and let us know. It will be great.

Notes

  • I don’t actually hate writing, though it may have been true in the past.
  • I do care about improving the school, a little.
  • I’ve only had one 42%.

The winner Shiina Akasaka wrote:

The problem with the majority of the RPI students is that they are incapable of communicating with each other. Many are staying in their rooms playing computer games all the time, some can only communicate through AIM. Inability to communicate well with others can cause the students to not be able to build strong friendships, a healthier community, and advancement in the academic field. Therefore, I would like to suggest an implementation of a required public speaking program, which will provide students to improve their communication skills and increase confidence in presenting their work in the future.

A public speaking program will improve everyone’s communication skills, which will promote a healthier and more interactive community. Communication skills can be used to improve students’ work environment, club activities, and interaction amongst other peers. If the students can work together and help each other, it will promote healthier relationship with other students. Club activities that are more organized will make students content, and they will enjoy the activity without worrying about unnecessary issues. Also, communication skills are helpful even after students leave RPI. In the real world, getting along with colleagues will not be a problem if RPI students gain good communication skills though a public speaking program.

Also, communication skills are required to present your thought process, your inventions, and research projects clearly. Therefore, a public speaking program will allow students to also excel significantly in academic areas. When RPI students publish technical papers or a thesis, which are written clearly and concisely, many of the engineers and scientists will be impressed. There are many bright students at RPI who are not able to express their full potential due to lack of communication skills.

I personally have taken a public speaking class, and it helped me to construct stronger arguments and helped the way I communicate in general, and at the same time, that class increased my confidence level on presenting my thoughts and beliefs. A public speaking program will have a significantly impact on our out-of-class experience.

Alright, Shiina’s essay is more appropriate and well written than the sarcastic bs I wrote. I too have taken a public speaking class and made the same argument in my final speech. Except I concluded such a solution would turn a great class into another ineffective professional development course. Students are better off taking the class on their own, when they want to. That said, Speech Communication with Merril Whitburn is one of the best courses I’ve taken. I would recommend it over any other elective.

Shiina: if you came across this from google, I hope you don’t mind I copied your paper off the union site.

local style

February 9th, 2007

This was emailed to me by Gary Craft, if you know who to credit for the original let me know.

Two locals, Bobby and Ralph, are sitting at their favorite hang out, drinking beer. Bobby turns to Ralph and says, “You know, I’m tired of going through life without an education. Tomorrow I think I’ll go to the community college and sign up for some classes.” Ralph thinks it’s a good idea and the two leave.

The next day, Bobby goes down to the college and meets the dean of admissions, who signs him up for the four basic classes: math, English, history, and logic.

“Logic?” Bobby says. “What’s that?”

The dean says, “I’ll show you. Do you own a weed eater?”

“Yeah.”

“Then logically because you own a weed eater, I think that you would have a yard.”

“That’s true. I do have a yard.”

“I’m not done,” the dean says. Because you have a yard, I think logically that you would have a house.”

“Yes, I do have a house.”

“And because you have a house, I think that you might logically have a family.”?

“I have a family.”

“I’m not done yet. Because you have a family, then logically you must have a wife.”

“Yes, I do have a wife.”

“And because you have a wife, then logically you must be a heterosexual.”

“I am a heterosexual. Whoa, brah, that’s amazing, you were able to find out all of that because I have a weed eater.”

Excited to take the class now, Bobby shakes the dean’s hand and leaves to go meet Ralph at the bar. He tells his friend about his classes, how he is signed up for math, English, history, and logic.

“Logic?” Ralph says, “What’s that?”

Bobby says, “I’ll show you. Do you have a weed eater?”

“No.”

“Then you mahu, brah!”

Always on the lookout

February 1st, 2007

Last semester I managed to visit a friend at Hampshire College, I think most famously known as the setting of Jarret’s Room on SNL, but more importantly it’s also an excellent liberal arts college in real life. My friend gave me and my roommate a campus tour.

d: It’s kind of weird here, I feel like I always need to be on the lookout.

me: You mean for people you know?

d: Yeah, then you have to say hi and it’s awkward to talk with them. It’s constant and kind of stresses me out.

me: At least people acknowledge each-other here. At my school if you see someone you know, the de-facto standard is to look at the ground and pretend they don’t exist.

Essentially his school is a complete polar opposite of the apathetic nerdy campus of RPI. A hippy college. I kind of liked it.

Aeroelasticity — don’t want the wings to rip off

January 25th, 2007

Aeroelasticity is probably one of the most mathematically complex fields in aerospace. At least that’s how it seems to me in one of my last courses in RPI’s undergrad program. It’s complex because it combines three areas that are already hard enough: elasticity (basic static beam bending), dynamics (motion of a beam, etc), and aerodynamics (forces caused by fluid/air). The interaction of these is what aeroelasticity aims to understand — with the overall goal of preventing flutter (see below) and divergence (wings ripping off within seconds) in the design of an airplane or anything for that matter. The most famous case of aeroelasticity in action is the Tacoma Narrows bridge, which I’m sure you’ve seen. Another example that I always notice is when you tie something on top of your car with straps and the straps vibrate. That is caused by the interaction of aerodynamic forces and dynamics/tension of the strap. Aeroelasticity is fun, or so I’ll keep saying to myself.

Flutter at a Glance

Longer version:

Note: Videos originally made by Bill Reed, AU/AE ‘46, now retired from NASA. I found them here and uploaded them to google video since windows media files suck.

Storytelling

January 23rd, 2007

If there’s any one skill I admire, it’s storytelling. Think about your favorite people, I bet they are good storytellers. If you look at successful people, they are amazing storytellers. Some say Steve Jobs has a reality distortion field. I attribute that to skilled storytelling. Skilled storytellers make even the smallest things fascinating.

Think of anyone — the best scientists (Feynman) are (was) able to tell amazing stories. Programmers like Paul Graham or Steven Yegge can write about anything and it’s still fun to read. They are excellent storytellers.

Enough famous people though. How about someone unknown? It’s almost embarrassing to admit, but I’m thinking of Violent Acres. She’s definitely a little off, but highly entertaining. After a couple months of writing she’s now internet famous for little reason other than she can turn her crappy ass days into amusing stories. It’s an impressive skill.

I like people who can tell good stories. I think I’m pretty decent at reading, listening, laughing and enjoying them. On the other hand, telling them certainly isn’t one of my strengths and improving that is one of the reasons I set up this blog. So far I’m doing a pretty terrible or at least highly inconsistent job. There are a whole lot of little things that are always happening, I just need to start writing them down.

foxnews is incompetent

December 26th, 2006

I’m writing a script that scrapes a couple news sites so I’ve been looking at the Fox News website more than I’d like. Their html is crap and they can’t even resize an image right. See:

<div id="dday">
<h2 class=""><a href="/story/0,2933,239018,00.html">
Former President Gerald Ford Dies</a></h2> 
<a href="/story/0,2933,239018,00.html">
<img src="/images/249298/1_61_ford_gerald_obit_1974.jpg" alt="" />
</a>
<p class="credit">AP</p>    
<p class="deck">Gerald R. Ford, 38th president and 
respected elder statesman who replaced Richard Nixon, 
has died. He was 93.</p>  
</div>

foxnews

what i’m like at school

December 12th, 2006

A recent IM conversation…

me: [check out my video]
rpi friend: is that you?
me: ha yeah
rpi friend: wow
rpi friend: i dont think i’ve ever seen you smile before