Arc Forumnew | comments | leaders | submitlogin
Hypothetical Web App: Image Gallery
4 points by tiglionabbit 6073 days ago | 5 comments
Just wondering how you guys would approach this pretty standard task. I've been jumping around frameworks, and am constantly surprised with the pitfalls each one has at doing something so common. I'm not asking you guys to write anything -- just brainstorm about whether it's currently pheasible, whether libraries exist, if anything would be particularly troubling, etc.

Task: Make an image gallery where users may log in via OpenID and upload files. Persistent information should be stored in a database, and uploaded files placed on the hard disk. All images should be sized down to a particular maximum size, and flickr style thumbnails should be generated for the gallery view. It should be possible to comment on the images, and the original uploader should be able to change the file without dissociating these comments. Also, users should be able to upload a small (automatically downsized) image to use as their personal icon.

Possible Pitfalls and Considerations: How do we tell if the file is not an image? What do you do then? What if the file is really big, and eats up our bandwidth / disk space? Do we have any support for truly temporary files? We wouldn't want one user's file to upload over another, when we're still trying to shrink and process it. How do we avoid orphaning images if users re-upload things? Should user icons be considered the same sort of thing as gallery images? Should we store anything relating to the images in our database at all?



3 points by almkglor 6073 days ago | link

> All images should be sized down to a particular maximum size, and flickr style thumbnails should be generated for the gallery view.

Arc has exactly 0 support for this. Maybe add this to TODO list of libraries for Arc?

> How do we tell if the file is not an image?

Check the binary file for each of the common formats?

> What do you do then?

If it's not an image, summarily delete it and tell the user that it didn't match one of the supported formats.

> What if the file is really big, and eats up our bandwidth / disk space?

Set a limit on HTTP PUT or POST. If it exceeds a certain size, complain to the user.

Note however that the Arc Server does not support PUT operations yet.

> Do we have any support for truly temporary files?

/tmp ?

> We wouldn't want one user's file to upload over another, when we're still trying to shrink and process it. How do we avoid orphaning images if users re-upload things?

Tough. Not sure what you exactly mean with this though.

> Should user icons be considered the same sort of thing as gallery images?

Not sure what you mean by this either. What do you mean by "user icons"?

> Should we store anything relating to the images in our database at all?

Database? What database?

LOL.

Arc has 0 database support for that matter.

-----

3 points by kens 6073 days ago | link

What support do you need for image processing beyond (system "ImageMagick ...")?

But seriously, if you're planning to implement an image processing library, take a look at the Common Lisp bindings to ImageMagick: http://common-lisp.net/project/cl-magick/

-----

3 points by almkglor 6073 days ago | link

> What support do you need for image processing beyond (system "ImageMagick ...")?

http://arclanguage.org/item?id=3522

-----

1 point by tiglionabbit 6073 days ago | link

>> We wouldn't want one user's file to upload over another, when we're still trying to shrink and process it. How do we avoid orphaning images if users re-upload things?

>Tough. Not sure what you exactly mean with this though.

This was actually part of the previous point, about temporary files. Many languages have tempfiles in their standard library. These help when you have a lot of users uploading things, and you want to make sure files don't clobber each other before you can decide where to put them. http://docs.python.org/lib/module-tempfile.html http://www.ruby-doc.org/core/classes/Tempfile.html

>> Should user icons be considered the same sort of thing as gallery images?

>Not sure what you mean by this either. What do you mean by "user icons"?

Most forums and art sites let their users upload a little picture, which is placed by each of their comments or posts. The difference between this and a normal image on the site is that, while other pictures may exist in different forms (e.g. full view / original, medium size, and thumbnail), user icons often only show up in one small standard size, and the original image they were shrunken from is not saved.

-----

1 point by sacado 6073 days ago | link

As for database, I think sqlite was almost working last time I looked at it. Maybe it's working now ?

-----