Design best practice for an image library

If the library holds data in a raw format (ie a big sized image), then can then make all sorts of algorithms out of that to produce images.


  • Generate different sizes, eg 100x100, 200x400 or what ever is required from the original
  • Generate different types of images, either by conversion (png etc) or type, maybe base 64 for CSS and separate style sheet images for non base64 supporting CSS (like IE8 etc)
  • Overlay another graphic on top (like a sash or otherwise) to generate only 1 image that needs to be retrieved

All of this requires the smarts that you allow the original image to have coordinates stored against it as to where the center is or maybe use something like https://github.com/tapmodo/Jcrop to create and store these coordinates of the box sizes.



I've found it quite useful when uploading images through custom application to write the files as (for example)

  • full_raw.png (usually stored in a database somewhere)
  • full100x100.png (resized, re scaled depending how it was done)
  • full100x100.txt (base64 if required - Coldfusion has a tag called imageWriteBase64 for this)
  • full200x200.png (maybe a retina double sized)
  • full200x200.txt (base64 if required)

 Then all the data is available to create CSS dynamically etc

Comments

Popular posts from this blog

cf_sql_timestamp vs cf_sql_date vs getdate()

Global SQL Procedure, System Objects and sp_ms_marksystemobject

Ghost Records, Card Recon and PCI Compliance