Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I can display an image commerce file as a rendered file and selecting a view mode (Large), but how do I further style the image in the product display template file?
I can show the image using:
if (!empty($product->commerce_file)):
php endif;
print render($content['product:commerce_file']);
I can use a div to resize the image, but I wanted prefer to style it in img tags as I am mixing these images with other images in view displays that show Content as opposed to fields...
How would I achieve:
<img width="Xpx" height="Ypx" src="my commerce file" class="hover" alt="">
Comments
Comment #2
alpinemedia CreditAttribution: alpinemedia commentedComment #3
alpinemedia CreditAttribution: alpinemedia commentedWorked it out
then used
<img height="X" src="<?php print $file_image; ?>" class="hover" alt="">
Comment #4
alpinemedia CreditAttribution: alpinemedia commented