Is there any documentation or forum posts on how individually draw image machine image types in via custom field, and still have them resized? Have a client that needs two different image systems on his product page, and I planned to use image types for the "main product images" and not assigned images in a separate carousel system. Has anyone messed with breaking up the display of the image machine on the product page into two separate sections? Worst case scenario, to keep them separate I could simply create a boat load of image types and draw them into their proper sections, but I just can't find anything on making sure that while drawing them in as custom fields that they also get resized.
Announcement
Collapse
No announcement yet.
Image Machine w/ Custom Fields
Collapse
X
-
Image Machine w/ Custom Fields
Ted Hust
AarcMediaGroup.com
Celebrating 13 Years of Outstanding Service & Support
Miva Merchant DesignTags: None
-
You can pull in any images you want and set the image sizes using template code:
http://docs.miva.com/code-samples/ou...-product-image
Also see this additional code. It allows you to rewrite a url to pull in the image size you want:
https://gist.github.com/bheyde/26d12...165a6bc182a79a
-
Well I have them firing, but my issue now is if the image is smaller than the sizes I set out, it doesn't generate. It's fine if the uploaded image is larger, but if it's smaller it just goes blank......
<mvt:assign name="l.constraints[1]:height" value="600" />
<mvt:assign name="l.constraints[1]:width" value="600" />
<mvt:assign name="l.imagetype_codes[1]" value="'Detail'" />
<mvt:assign name="l.constraints_count" value="miva_array_elements( l.constraints )" />
<mvt:assign name="l.imagetypecode_count" value="miva_array_elements( l.imagetype_codes )" />
<mvt:do file="g.Module_Library_DB" name="l.imagedata_count" value="ProductImageDataList_Load_Product_TypeCodes _Constrained(l.settings:product:id, l.imagetype_codes, l.imagetypecode_count , l.constraints,l.constraints_count,l.settings:produ ctimagedatalist)" />
<mvt:comment>
| Check and see if the image exists, if not, Generate the file and return its path.
</mvt:comment>
<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_Dimension s( l.settings:productimagedatalist[1]:image, l.constraints[1]:width, l.constraints[1]:height, l.settings:generatedimage )" />
<div class="product-image">
<a href="&mvt:generatedimage:image;" data-lightbox="productMain"><img src="&mvt:generatedimage:image;" class="img-thumbnail" /></a>
</div>
<mvt:else>
<div class="product-image">
<a href="&mvt:productimagedatalist[1]:generatedimages[1]:image;" data-lightbox="productMain"><img src="&mvt:productimagedatalist[1]:generatedimages[1]:image;" class="img-thumbnail" /></a>
</div>
</mvt:if>Ted Hust
AarcMediaGroup.com
Celebrating 13 Years of Outstanding Service & Support
Miva Merchant Design
Comment
-
So how do you tell this snippet to spit out the ORIGINAL image if the image in question is smaller than the constraint settings? That's my only other issue, otherwise this works like a charm.Ted Hust
AarcMediaGroup.com
Celebrating 13 Years of Outstanding Service & Support
Miva Merchant Design
Comment
Comment