[ansel] Store images with extension?
Alan Garrison
alang at cronosys.com
Tue Sep 7 13:43:53 PDT 2004
Just a thought, how about something like this:
(file md5sum)_(original filename)
e.g.,
2c7f55d3aae7037c094b116d7b257b89_image2.jpg
Or perhaps
(uploader user-id)_(file md5sum)_(original filename)
e.g.,
joebob_2c7f55d3aae7037c094b116d7b257b89_image2.jpg
or even
(uploader user_id)_(upload timestamp)_(original filename)
e.g.,
joebob_10298309230_image2.jpg
md5'ing the file may be useful if you are looking for the same exact
image with possibly a different name, though some may consider this too
much overhead. The user+timestamp+name should probably negate any
chance of a dupe name, should be trivial to calculate on the fly, and it
still keeps the basic filename structure (just tacking on stuff to the
front). Of course you'll have to properly escape the user id and filename.
Ben Chavet wrote:
> There is one problem with that: filename collisions.
>
> The storage locations are calculated by a hash table to make copying &
> moving
> images from gallery to gallery less work for the server. How would we
> handle
> multiple files named image2.jpg? They would all end up in the same hash
> and
> would have to be renamed anyway. Then, how would you tell which
> image2.jpg you
> are looking for unless you use the DB to figure it out? Seems like a
> vicious
> cycle to me :)
>
> It would work great if users would actually give images a meaningful
> name. But
> who takes that kind of time? Especially when you can store hundreds of
> images
> on a digital camera? I personally dump the images off of my camera
> directly
> into ansel using the XP upload feature. Then I rotate and rearrange as
> necessary.
>
> --Ben
>
> Quoting "Heath S. Hendrickson" <heath at outerspaceconsultants.com>:
>
>> I often wondered initially why the file names were changed to random
>> names. I think it was due to some of the legacy code that Ansel started
>> from (Chuck will correct me if I'm wrong here), but it also got around
>> the penchant of windows users to use illegal (for *nix, anyway)
>> characters (!, $, ?).
>>
>> On a related note, would it be that difficult to store the files with
>> the original names after passing it through a sanitization filter
>> (depending on what host OS Ansel was running under)? This way a backup
>> of the Ansel image directory is directly useable instead of having to
>> use the DB to figure out what file was what. I know that the orginal
>> filename is stored in the DB and presented when the image is
>> viewed/downloaded, but I'm just thinking about it from a lower level.
>>
>> heath
>>
>> Jan Schneider wrote:
>>
>>> What do you think about storing the images in the VFS backend with an
>>> extension matching the actual image format?
>>>
>>> This would fulfill two purposes: If you change the default image
>>> format in
>>> the configuration, thumbnail images would be regenerated
>>> automatically. And
>>> if you use the Alias feature to display the images directly out of
>>> the VFS
>>> backend, they have the correct extension and you could use them
>>> outside of
>>> <img> tags, plus the webserver sends the correct Content-Type.
>>>
>>> Jan.
>>>
>>>
>>
>> --
>> ansel mailing list - Join the hunt: http://horde.org/bounties/#ansel
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: ansel-unsubscribe at lists.horde.org
>>
>>
>
>
--
Alan Garrison
Cronosys, LLC <http://www.cronosys.com>
More information about the ansel
mailing list