WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Inline height & width attributes for product image (3 posts)

  1. tmpldesign
    Member
    Posted 1 year ago #

    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="http://mydomain.nl/wp-content/uploads/2012/11/sprite2.jpg" class="attachment-shop_single wp-post-image" alt="sprite2" title="sprite2" data-o_src="http://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!

    http://wordpress.org/extend/plugins/woocommerce/

  2. bheadrick
    Member
    Posted 1 year ago #

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

  3. tmpldesign
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic