Sorry to resurrect a fairly old thread, but I wanted to update you on my recent working with the code you provided.
I played with that GitHub code a month or two ago and had to make a change. When loading an image into an html page I think it worked fine, but if I wanted to access an image directly, it dumped the image data as text onto the screen. To fix this, I added an HTTP header to declare the content type:
Code:
<mvt:if expr="ISNULL l.settings:productimagedatalist[1]:generatedimages[1]:image"> <mvt:do file="g.Module_Library_DB" name="l.ok" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.settings:productimagedatalist[1]:image, l.constraints[1]:width, l.constraints[1]:height, l.settings:generatedimage )" /> <mvt:assign name="l.ok" value="file_read( '/' $ g.Domain:mod_root $ l.settings:generatedimage:image, 'script', g.image_data )" /> <mvt:else> <mvt:assign name="l.ok" value="file_read( '/' $ g.Domain:mod_root $ l.settings:productimagedatalist[1]:generatedimages[1]:image, 'script', g.image_data)" /> </mvt:if> <mvt:assign name="g.header" value="miva_output_header( 'Content-type', 'image/jpeg' )"/> <mvt:eval expr="g.image_data" />
I also don't want every image to have the same name, so I'm going to create my own rewrites to allow dynamic names and file paths that set all the parameters. This is going to be very useful in an upcoming website redesign. I'm going to try to avoid using Image Machine at all for the entire site, which should be fun.
I still think something like this should be baked into a future release. Maybe V10, since it sounds like that's where all the CMS stuff is happening.
Thanks again for the code!
Josh
Leave a comment: