• tmpldesign

    (@tmpldesign)


    Hey guys,

    I’m having some issues with the product images. They seem to constantly get inline height and width styles set to them but I can’t seem to find where it’s coming from. Anybody able to help me?

    At the moment in the HTML code the image has the following styles:
    <img width="190" height="142" src="https://mydomain.nl/wp-content/uploads/2012/11/sprite2.jpg" class="attachment-shop_single wp-post-image" alt="sprite2" title="sprite2" data-o_src="https://mydomain.nl/wp-content/uploads/2012/10/explorer.jpg" data-o_title="explorer">

    This is the default code to get the product image.
    <?php echo get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) ) ?>

    Now i’ve tried setting ‘single_product_large_thumbnail_size’ & ‘shop_single’ to ‘full’ to get the full-size image but that was no solution it seems.

    Any help would be welcome!

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • bheadrick

    (@bheadrick)

    get_the_post_thumbnail will automatically add inline width and height. Why do you want to remove them?

    Thread Starter tmpldesign

    (@tmpldesign)

    I wanted to remove them because they were messing with a script I am using to make a sprite of images into a 360 degree image rotator.

    I solved it by using the following code:

    <?php echo get_the_post_thumbnail( $post->ID, array(0.1,0.1), array('class' => 'reelme') ) ?>

    After that I’ve reset the height and width attributes using jQuery.

    The 0.1 is a hack to make WordPress not set the height and width attributes. It’s not the most elegant way to do it I guess, if anybody has a better solution please share.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Inline height & width attributes for product image’ is closed to new replies.