Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author TinyPNG

    (@tinypng)

    Hi julienp,

    Thank you for sharing your experience with WooCommerce in combination with the plugin. We currently have not made an effort to support WooCommerce, but we may be able to support this in the future. We see it has quite a big user base and understand it can be a good improvement to the plugin.

    At this moment, it is only possible by changing the code of the plugin yourself. If you can manage this and find a way to get it working, we would really like to hear your experience.

    Thread Starter julienp

    (@julienp)

    Thanks for the answer.
    Could you please tell me where I can find the php function that find the name of a picture like ‘xxxx_300x300.jpg’ ?

    I’ll search on the php code to adapt the function for woocomerce ??

    Plugin Author TinyPNG

    (@tinypng)

    Great that you’re trying it yourself! I found that the check if the file exists is located in class-tiny-compress.php: https://github.com/TinyPNG/wordpress-plugin/blob/master/src/class-tiny-compress.php#L65-67

    Maybe you can check the watermarked image is present, in case the original image is not found?

    Thread Starter julienp

    (@julienp)

    Yeah that’s what I thought ??
    I’ll try if it works

    Thank you !

    Thread Starter julienp

    (@julienp)

    I fix it ??
    When it was a ‘watermarked file’ like :

    https://s3bfotovideo.com/test/wp-content/uploads/2015/01/124-150x150_watermarked.jpg

    the $file was :’/home/sbfotovihr/www/test/wp-content/uploads/./minimalistic-patterns_00378980-150×150.jpg’

    The folder was not present, so in the php I’ve modify the function:

    public function compress_file($file) {
    if (!file_exists($file)) {
    // throw new Tiny_Exception(‘File does not exists’, ‘FileError’);
    $file= str_replace(‘/./’, ‘/2015/01/’, $file);
    if (!file_exists($file)) {
    throw new Tiny_Exception($file, ‘FileError’);
    }

    }
    list($output, $details) = $this->compress(file_get_contents($file));
    file_put_contents($file, $output);
    return $details;
    }

    The problem is that I have to modify manually the php when the photo folder is different, but now I can compress all of my jpg… ??

    Plugin Author TinyPNG

    (@tinypng)

    Ok, I’m glad it works now! Thanks for sharing your experience and changes to the code, it may be helpful for others using WooCommerce as well.

    Do note that, when updating the TinyPNG plugin, your changes to the source code can be overwritten. Maybe, in the future, we will support WooCommerce in the plugin as well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with woocomerceProduct’ is closed to new replies.