Hacking the Image Library

Overview - Hacking the Image Library

One of the most powerful, often misunderstood features in Zoovy is the Image Library, which allow users to easily upload and store images without knowing the size or details. When you upload a file into the Image Library Zoovy will automatically resize it to the appropriate size for the image you are working with.
Storage
In the Zoovy system each Images is stored in a hashed directory based on the first letter of their first name. This provides for a quick and easy way to lookup an image (and its corresponding directory) based on nothing more than the images name. It also prevents the users from needing to have a complicated sorting method. Web users should use the filename exclusively, whereas windows clients may want to save additional data in a briefcase.
Process
So lets say you upload XXX.gif here's what happens:
  • "We create XXX.dd is probably a data dumper of a data structure that identifies xxx.gif as the original and tracks the subordinates.
  • "We should find out which color to use as the transparency. Probably either upper left or lower right color, or no transparency.
  • "We tell the user "Thanks for creating the collection", perhaps we ask them what this image should be used for (so we can properly display its personality eg: product, logo, or info).
  • "The user maps collection to some element of their site, eg: logo and then that product flow (in the case of product and info graphics) or layout (in the case of logos) then specifies what the proper: background color, background graphic (in the case of logos), horizontal size, and horizontal width. Any components not specifically requested will be left up to a best match which means any match. This will work particularly well since we'll be able to look in our cache and see if we have anything that matches, if we don't we'll build something.
  • In this case the preview/thumbnail view could reference one copy, and the theme view could reference another, so the image looks tits in both examples. Its almost scary because the user probably won't even realize that the image always looks good, we're just adding the backgrounds, etc. when we need to.
  • Behavioral Notes
    Behavioral Notes: The Collection Names must be be A-Z,a-z,0-9,_ and are case sensitive. Each collection contains a which file is the original, a list of instances that are related to that image (eliminates the need to having to a filesystem lookup each time we try to do a 'best guess' match). It is important to realize that the collection files must be generated by Zoovy, without them the system would not know what to do with the files, therefore conventional methods of transferring files such as FTP are not compatible. At the end of the day it�s a small price to pay for the additional functionality that Image Library delivers. Okay now the URL format for the handler should be forward compatible, so when we want to add new features we don�t have to change things. I�m going to propose the following URL format:
    URL Format
    http://static.zoovy.com/collection/USERNAME/FORMAT/COLLECTION_NAME The FORMAT portion is by far the most interesting. It works in a format like: XVALUE1-XVALUE2 where X is a single letter A-Z, and value is obviously a value, the meaning of value changes depending on which letter X is.
    W Required Image Width (followed by a decimal value for the width in pixels)
    H Required Image Height (followed by a decimal value for the height in pixels)
    B Background Color (followed by an RGB hex value)
    L Value is a theme/wrapper name, which will specify that the image should be applied to the LOGO background of theme.
    C Compression value 0-9, 0 being highest quality, 9 being lowest. In certain situations it may be necessary to pre-load a low compression version of a file.
    Z Always show the Zoovy logo. ;-)
    F Fudged Up (value should be 1), don't cache, always rebuild.
    So for example the URL: http://static.zoovy.com/collection/BRIAN/W100-H100/foobar
    Would return a 100x100 version of the
    http://static.zoovy.com/collection/BRIAN/-/foobar
    Would return the original copy of the foobar image.

    http://static.zoovy.com/collection/BRIAN/Ll1_snowman-W300-H300/prettylogo
    Would return a best match for the persons logo, against the snowman theme.
    Special Files
    Requesting an image of [LOGO] will return the merchants currently configured logo. e.g. http://static.zoovy.com/img/USERNAME/-/[LOGO].jpg this is handy if you are planning to create templates that can be used across multiple stores.
    Footer information

    Sitemap