I have put together a few sample files, a while ago:
http://www.opencart.com/index.php?route ... n_id=23506
Further: In order to have ALL images 'DONE', it takes a little work, to find, troughout the ALL_FILENAMES.TPL Source-Files, all image Links, and manually hardcode the width+height, where real VALUES are missing on Browser Page Source. In Addition, in some VqMod's may be some image Links as well, they have to be renamed too, if one wants to make it complete.
Ernie
bigmax.ch/shop/
http://www.opencart.com/index.php?route ... n_id=23506
Further: In order to have ALL images 'DONE', it takes a little work, to find, troughout the ALL_FILENAMES.TPL Source-Files, all image Links, and manually hardcode the width+height, where real VALUES are missing on Browser Page Source. In Addition, in some VqMod's may be some image Links as well, they have to be renamed too, if one wants to make it complete.
Ernie
bigmax.ch/shop/
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
ı Looking oc mod or vqmod oc 2.0.3.1
1-Specify image dimensions opencart
2-Serve scaled images opencart
can you help me ?
1-Specify image dimensions opencart
2-Serve scaled images opencart
can you help me ?
As I recall, such Mod exists already for some OC-2.saliverdim wrote:ı Looking oc mod or vqmod oc 2.0.3.1
1-Specify image dimensions opencart
2-Serve scaled images opencart
can you help me ?
But I cannot longer create&test such Mod's, because I have no working V-2 Versions online.
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Hi,
for OC 2 i'm using this vQmod, is any problem with this?
for OC 2 i'm using this vQmod, is any problem with this?
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Images width and height tags</id>
<version>1.0.0</version>
<vqmver required="true">2.4.0</vqmver>
<author>me</author>
<file name="catalog/model/tool/image.php">
<operation>
<search position="replace"><![CDATA[$image_new;]]></search>
<add><![CDATA[$image_new . '" width="' . $width . '" height="' . $height;]]></add>
</operation>
</file>
</modification>
I explained it here, and added a VqMod as well as an OcMod to it:
viewtopic.php?f=190&t=185410&p=686890#p686890
Good Luck!
Ernie
viewtopic.php?f=190&t=185410&p=686890#p686890
Good Luck!
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
This code it works great but on main domain only, not multistore, any solution?
Thanks
Thanks
byens wrote: ↑Tue Jan 07, 2014 5:38 pmwith q's mod, i have better result.Qphoria wrote:According to Google Page Speed tips. One tip is for web pages to include the width/height tags in the rendered html.
http://code.google.com/speed/page-speed ... Dimensions
So I did some playing with regex on the output code and it seems to be working.
This code will automatically generate the image size tags and insert them into every img tag in your page to comply with the Google Page Speed image tips automatically.
Not sure of the overall performance hit but it works. YMMV:
1. EDIT: system/library/response.php
2. FIND:3. BEFORE, ADD:Code: Select all
if ($this->level) {
Code: Select all
//Q: Add width/height tags to all images for Google Page Speed tip: //http://code.google.com/speed/page-speed/docs/rendering.html#SpecifyImageDimensions preg_match_all('/<img[^>]+>/i', $this->output, $result); $img = array(); foreach($result[0] as $img_tag) { preg_match_all('/(width|height|src)=("[^"]*")/i',$img_tag, $img[$img_tag]); } foreach ($img as $k => $info) { if (count($info) == 3 && $info[1][0] == 'src') { //if (curl_init(str_replace('"', '', $info[2][0]))) { $imgfile = str_replace('"', '', $info[2][0]); $imgfile = str_replace(HTTP_SERVER, DIR_IMAGE . '../', $imgfile); $imgfile = str_replace(HTTPS_SERVER, DIR_IMAGE . '../', $imgfile); if (file_exists($imgfile)) { $image_info = getImageSize(str_replace('"', '', $imgfile)); $k = trim($k, '/>'); $k = trim($k, '>'); $this->output = str_replace($k, ($k . ' ' . $image_info[3]), $this->output); } } } //
However it returns error:
PHP Notice: Undefined offset: 0 in /srv/users/serverpilot/apps/tokolingerie/public/system/library/response.php on line 66
line 66: if (count($info) == 3 && $info[1][0] == 'src') {
php5.5+nginx opencart1.5.4.1
Anyone have solution for this?
This is wonderful code. To much speed up site. But come some small foult:Qphoria wrote: ↑Wed Sep 15, 2010 11:18 pmCode: Select all
//Q: Add width/height tags to all images for Google Page Speed tip: //http://code.google.com/speed/page-speed/docs/rendering.html#SpecifyImageDimensions preg_match_all('/<img[^>]+>/i', $this->output, $result); $img = array(); foreach($result[0] as $img_tag) { preg_match_all('/(width|height|src)=("[^"]*")/i',$img_tag, $img[$img_tag]); } foreach ($img as $k => $info) { if (count($info) == 3 && $info[1][0] == 'src') { //if (curl_init(str_replace('"', '', $info[2][0]))) { $imgfile = str_replace('"', '', $info[2][0]); $imgfile = str_replace(HTTP_SERVER, DIR_IMAGE . '../', $imgfile); $imgfile = str_replace(HTTPS_SERVER, DIR_IMAGE . '../', $imgfile); if (file_exists($imgfile)) { $image_info = getImageSize(str_replace('"', '', $imgfile)); $k = trim($k, '/>'); $k = trim($k, '>'); [b]$this->output = str_replace($k, ($k . ' ' . $image_info[3]), $this->output);[/b] } } } //
Notice: Trying to access array offset on value of type bool in /vqmod/vqcache/vq2-system_library_response.php on line 168
And also strached images. Opencart 1.5.6.5 Please help to repair. Thanks in advance.!$this->output = str_replace($k, ($k . ' ' . $image_info[3]), $this->output);
Attachments
tmp-cam-7368236236797851983.jpg (56.71 KiB) Viewed 3938 times
tmp-cam-5647590236441118074.jpg (91.24 KiB) Viewed 3938 times
Who is online
Users browsing this forum: No registered users and 46 guests