I'm returning an image uploaded through the imagefield module for a node, and captioning it with the title of the node. Although automatic syntax did not work for me (ie) return $node->title; I was able to write a SQL query that would return the correct title.

The problem I have is that users are not forced to upload an image, so often default images are used. In this case, I still have to caption the default image, but any SQL that selects the title based on the filepath will not work for obvious reasons.

I got it working by passing a variable to the image URL (ie) [imagepath]?t=$node->title in the template and simply if(isset($_GET['t'])) return check_plain($_GET['t']); in the imagecache preset.

My question is...will this cause ImageCache to constantly recreate this image? If anyone has a tip on a better way to go about this I'd love to hear it.

Thanks in advance-

Comments

dman’s picture

Status: Active » Closed (won't fix)

While that is novel, and does seem to work a bit, the NEXT time you request the same image with a different title, you will get the old title, as the query string will be dropped once Apache discovers the file exists.

I can see where you are going with this, but on-the-fly dynamic image generation from parameters os out-of-scope for imagecache (I discussed the idea a long time ago)
BUT I'd like to see the imagecache actions re-used as part of the imageapi suite, so maybe some other image-generation harness could be built that works a bit like imagecache, runs on the same libraries, but has a different purpose..