The rain really came down and overfilled the pool. Perfect for bomb dives in better weather. (Taken with instagram)
Image Cache BE GONE! - Removing ?4434543454353453
I was attempting to use a fantastic jquery lightbox image gallery which shows thumbnails of images within the gallery.
However, due to RUBY ON RAILS being almost too perfect, it was not working.
Further digging around on the interwebs revealed that the standard caching of images which appends ‘?32234234’ being a date time stamp, was causing problems with rendering thumbnails.
As I am better at rails than jquery, i included this line of code to fix the problem.
<%= link_to image_tag(person.photos.first.image.url(:tiny)).gsub(/\?\d+$/, ”), person.photos.first.image.url(:medium).gsub(/\?\d+$/, ”), :rel => “personPhoto[#{person.cachedslug}]”, :alt => “#{person.first_name}”, :title=>”Viewing: #{person.first_name}’s Pics” %>
What it does, is removes the question mark and all trailing numbers prior to rendering the contents of the image tag.
Seems a bit cumbersome, but it works … it could use some refactoring, but that comes at a later stage in the project.
I would love to hear your thoughts?







