WordPress.org

Forums

WooCommerce Twitter's Bootstrap
UTF-8 thumbnail img src (9 posts)

  1. firemniweb
    Member
    Posted 1 year ago #

    Hi,

    please I have a problem with thumbnail. Img have bad src if image have space or diacritic in file name... In detail of product or homepage it's OK.. But in category loop is wrong.

    Can you help me?

    screen with plugin http://i.imgur.com/ntQhGed.png
    screen without plugin http://i.imgur.com/Xs38p0x.png

    Thanks, (sry for my english, I hope you understand me)

    Luke from czech

    http://wordpress.org/plugins/woocommerce-twitterbootstrap/

  2. bassjobsen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Luke,

    Thanks for posting your issue. I will try to fix it asap.

    Best regards,

    Bass

  3. bassjobsen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Luke,

    line 580 of the plugin is now:

    echo utf8_decode($doc->saveXML($image)); break;

    I expect utf8_decode() here cause your problem.

    I you want to test this, replace this line with:

    echo $doc->saveXML($image); break;

    This decoding don't seems to make sense at all. I will test this and remove it in the next version.

    Thanks and best regards,

    Bass

  4. firemniweb
    Member
    Posted 1 year ago #

    Hi Bass,

    I downloaded update. But it still doesn't work right.

    If you can tested on my site. Write me at skype lukas.pavel1

    Luke
    Thanks for your help

  5. bassjobsen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Luke,

    Yes, sorry i see. I expected DOMDocument utf-8 encoded by default, but it is not for some reason.

    Please replace line 572 - 580 with:

    $doc = new DOMDocument();
    $doc->loadHTML('<?xml encoding="'.DB_CHARSET.'">' . $thumbnail );
    $images = $doc->getElementsByTagName('img');
    foreach ($images as $image) {
    $image->setAttribute('class',$image->getAttribute('class').' img-responsive');
    $image->removeAttribute('height');
    $image->removeAttribute('width');
    //see: http://stackoverflow.com/questions/6321481/printing-out-html-content-from-domelement-using-nodevalue
    echo $doc->saveXML($image); break;
  6. firemniweb
    Member
    Posted 1 year ago #

    It's working :)

    Thanks and best regards,

    Luke

  7. bassjobsen
    Member
    Plugin Author

    Posted 1 year ago #

    fixed in version 1.3.0

  8. bgouban
    Member
    Posted 1 year ago #

    I'm still having this issue.

    In category template :
    /wp-content/uploads/2014/05/Comptoir-T-modifié-300x225.jpg

    Whereas it's working fine in single product template :
    /wp-content/uploads/2014/05/Comptoir-T-modifié-360x270.jpg

    Do you know what's wrong ?

    Thanks for your help !

  9. bassjobsen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi @bgouban,

    Thank for posting your issue.
    Since this issues pops up again i think changing the thumbnail HTML code within a DOMDocument is not a good idea at all.
    I will consider this code in the next version.

    For now as i understand WordPress defines the encoding twice.
    The encoding for the database in wp-config.php with define('DB_CHARSET', 'utf8');
    And secondly the HTML encoding, as i understand you can change this value since version 3.5 (http://codex.wordpress.org/Function_Reference/bloginfo) and is UTF-8 always.

    So i expected your DB_CHARSET is not utf-8 (or the data in your database is not encoded utf-8).

    So echo $doc->saveXML($image); break; on line 609 prints the wrong encoding.
    Are you enable to test changing this line into the following code:
    echo iconv('UTF-8',DB_CHARSET,$doc->saveXML($image)); break;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce Twitter's Bootstrap
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags