[Radiant] Image Caching
Daniel Sheppard
daniels at thegroggysquirrel.com
Thu Nov 1 18:19:53 CDT 2007
> I am working on an image extension, which stores the images in the
> database, then resizes them on retrieval. To make this at all
> usable,
> I of course need to be able to cache the images. I had hoped to use
> the Radiant system to do this, but so far have been unable to make
> this work. I am basing the controller on the Radiant site_controller
> and have been able to write the image to the cache folder without
> problem.
>
> The problems start when retrieving the image: first it does not
> recognize that an image has been cached and when I force it, then
> retrieving the image results in a blank page.
>
> Two questions: should I even bother with the Radiant system? Does it
> bring me an advantage or should I just use the standard rails caching.
>
> Second Question: what am I doing wrong? Can this system even cache
> images?
You're doing nothing wrong, in fact, you're reproducing my
shards_attachment extension (which you shouldn't use because I find
parts of it distasteful and plan on rewriting it with unit tests and
a decent interface for transformation... eventually)
http://soxbox.no-ip.org/radiant/svn/extensions/shard_attachments/
and probably more specifically:
http://soxbox.no-ip.org/radiant/svn/extensions/shard_attachments/lib/part_attachments/site_controller_extension.rb
There's nothing that jumps out at me from your code as being wrong,
but I've been using the same technique that you're attempting for
well over a year now, and it works a treat for me.
Dan.
More information about the Radiant
mailing list