Ernie
Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'800+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.
Even if you added the extension and mime types to the supported list under the "Server" tab in your store settings in the admin and modified the image library functions, if it is not supported by PHP, then you are just wasting your time.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Thank you...next.
So any plans for OC to adopt this?
but keep in mind that you will have to cache both jpg and webp versions of the images as not all browsers accept webp.
and you have to perform the accept check to determine if you return webp or jpg.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Code: Select all
public function webpSupport() {
$support = false;
$gd = gd_info();
// if gd supports webp
if ($gd['WebP Support']) {
// if browser accepts webp images
if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'webp')) {
$support = true;
}
}
return $support;
}
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Code: Select all
if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'webp')) {
Code: Select all
if (isset($this->request->server['HTTP_ACCEPT']) && strpos($this->request->server['HTTP_ACCEPT'], 'webp')) {
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
then you would send out the right images by:
Code: Select all
if ($this->request->server['HTTPS']) {
return $this->config->get('config_ssl') . 'image/' . ($this->webp_support() ? $your_webp_image : $your_jpg_image);
} else {
return $this->config->get('config_url') . 'image/' . ($this->webp_support() ? $your_webp_image : $your_jpg_image);
}
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
In accordance to: http://php.net/manual/en/image.constants.php , as for PHP v7.1.0 , there's a similar way to adapt this without validation needed in both admin/model/tool/image.php and catalog/model/tool/image.php files.letxobnav wrote: ↑Sat Mar 02, 2019 3:17 pmtrue, and if you are sure your php gd version support webp you can take out the gd_info() part of the check.
then you would send out the right images by:Code: Select all
if ($this->request->server['HTTPS']) { return $this->config->get('config_ssl') . 'image/' . ($this->webp_support() ? $your_webp_image : $your_jpg_image); } else { return $this->config->get('config_url') . 'image/' . ($this->webp_support() ? $your_webp_image : $your_jpg_image); }
Find:
Code: Select all
if (!in_array($image_type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF))) {
Code: Select all
if (!in_array($image_type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_WEBP))) {
Note: Not a replacement solution, simply an addition to it.
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
the code with problems is this,
Code: Select all
public function webpSupport() {
$mod = 'rm_lwi';
$support = false;
if ($this->config->get($mod . '_status') && $this->config->get($mod . '_webp_status')) {
$gd = gd_info();
if ($gd['WebP Support'] && strpos( $_SERVER['HTTP_ACCEPT'], 'webp' ) ) { //this line error HTTP_ACCEPT unable or empty
$support = true;
}
}
return $support;
}
Code: Select all
if ($gd['WebP Support'] && (strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false )) {
PHP Notice: Undefined index: HTTP_ACCEPT in /home/........./public_html/system/storage/modification/catalog/model/tool/image.php on line 8
Code: Select all
if ($gd['WebP Support'] && (strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false )) {
Code: Select all
public function webpSupport() {
$mod = 'rm_lwi';
$support = false;
if ($this->config->get($mod . '_status') && $this->config->get($mod . '_webp_status')) {
$gd = gd_info();
if ($gd['WebP Support'])
{
// if browser accepts webp images
if (isset($this->request->server['HTTP_ACCEPT']) && strpos($this->request->server['HTTP_ACCEPT'], 'webp')) {
$support = true;
}
}
return $support;
}
}
if it's not defined, it can not be understud and handled accordingly, since it's
not an OC default global variable, as I am aware of.
Ernie
https://stackoverflow.com/questions/513 ... ttp-accept
Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'800+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.
As for the HTTP_ACCEPT, see this post for more info: https://stackoverflow.com/questions/502 ... ttp-accept .
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
For quick, professional OpenCart support
Online
contact me on skype : dparakhiya_1
email : dipneshp@gmail.com
I am not sure how useful it could become since it has a 404 error message on the page.dparakhiya wrote: ↑Wed Jun 05, 2019 8:25 pmMaybe this Module useful: https://www.opencart.com/index.php?rout ... n_id=36923
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 12 guests