Page 1 of 2
is it possible to use external image link for the products?
Posted: Sun Dec 05, 2010 10:50 am
by neowing
I could not find external image function for the product in version 1.4.9.1 of opencart.
But sometimes i feel that using external image link will save more time to do product data entry, and easy to locate the image, especially when the connecting speed to server is going down.
i will be very happy if anyone can tell me more about this.
Re: is it possible to use external image link for the produc
Posted: Sun Dec 05, 2010 11:30 am
by justinv
I agree - I think images show up correctly in admin if they are entered as absolute urls, but they do not work on site as the image resizing functions open only files, not urls. I think there should be an easy way to allow images from other servers without messing with code, it would have helped me several times already. Obviously you'd have to either make sure images are the correct size on the server, or resize them in css (yuk).
Re: is it possible to use external image link for the produc
Posted: Sat Dec 11, 2010 1:09 pm
by justinv
Here is a simple tweak to the OpenCart core to allow external image links for product images. It will mean that your images are no longer resized, but at least you will have images!
In the file catalog/model/tool/image.php, replace line 4 where it says this:
With this:
I hope that helps someone else as much as it just helped me.
Re: is it possible to use external image link for the produc
Posted: Thu Dec 16, 2010 1:23 am
by honk
try this extension:
http://www.opencart.com/index.php?route ... order=DESC
This plugin can replace the default Opencart "Image Manager".
You can select images from your Google Picasa Web Albums directly(I think Flickr is comming soon).
No need to upload image to your site, it makes your site more lightweight.
Because the images are hosted at google's server, it makes your site faster.
Re: is it possible to use external image link for the produc
Posted: Fri Jun 17, 2011 10:46 pm
by NTCommerce
justinv wrote:Here is a simple tweak to the OpenCart core to allow external image links for product images. It will mean that your images are no longer resized, but at least you will have images!
In the file catalog/model/tool/image.php, replace line 4 where it says this:
With this:
I hope that helps someone else as much as it just helped me.
So simple yet afer three days of trying to suss this in 1.5.0.3 has just probably secured me a very large web development project. If we ever meet I'll by you a pint.
Thankyou
Re: is it possible to use external image link for the produc
Posted: Sat Jul 07, 2012 12:47 am
by Lobart78
Brilliant now images are loaded from external url thanks justin. However, is it possible to state the size of the image in thy php?
Re: is it possible to use external image link for the produc
Posted: Wed Jul 18, 2012 12:00 pm
by justinv
You'd need to state the size in the CSS - in tpl files, or directly in your CSS files.
Re: is it possible to use external image link for the produc
Posted: Mon Mar 25, 2013 11:11 am
by skullnbones
How do you state the size in the CSS - in tpl files?
I have changed the size in my CSS but the image size has stayed the same. How do you change it in the tpl files?
Re: is it possible to use external image link for the produc
Posted: Tue Dec 10, 2013 1:41 pm
by MicroCNC
Hopefully this might help somebody out.
replace catalog/model/tool/image.php line 16
with
Code: Select all
if (substr($filename, 0, 7) == 'http://') {
return $filename.'" height="'.$height.'" width="'.$width;
} else {
return;
}
It will check that the $filname starts with http:// and will use the variables passed from resize() to resize the image from the url.
I have this working on my shop
http://microcnc.net/shop/
Re: is it possible to use external image link for the produc
Posted: Tue Sep 02, 2014 2:12 am
by tgondal
HI everyone,
Thank you for the code, it does loads the images for external URL. However, there is a problem when you click on additional images below main product image, it opens the additional image from external site and takes the user out from my store. Any advice please
Thank you
Re: is it possible to use external image link for the produc
Posted: Wed Mar 25, 2015 11:32 pm
by murri
Thank you for the code! It saved me some time and trouble.

Re: is it possible to use external image link for the produc
Posted: Thu Mar 26, 2015 3:38 am
by IP_CAM
Now this is, what surpasses my (php code) wisdom, and I guess, some others could 'use/profit from' this information as well. (catalog/model/tool/image.php)
So, using the (believed) default oc v.1.5.6.4 image.php template, I have this:
Code: Select all
public function resize($filename, $width, $height, $type = "") {
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
Should I now ADD the external link Mod like THIS:
Code: Select all
public function resize($filename, $width, $height, $type = "") {
if (substr($filename, 0, 7) == 'http://') {
return $filename.'" height="'.$height.'" width="'.$width;
} elseif (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
}
to make it work in BOTH WAYS?
I like to test a lot, but not really everything, by myselfs.
Thanks a lot! (will try to give it back, some place...!)
Ernie
Re: is it possible to use external image link for the produc
Posted: Thu Apr 02, 2015 2:47 am
by ajrjain7
I am facing similar type issue , trying to add images and youtube videos on Information page, but once after saving it is modifying the url which causing Not Found Error for image and videos
opencart 2.0.1.1 , check below page where i tried to add correct url of video yet, facing issue
http://gymtrekkerstore.com/gymcart/inde ... ation_id=8
please help
Re: is it possible to use external image link for the produc
Posted: Sat Apr 04, 2015 8:24 pm
by IP_CAM
Because your'e trying to call the Movie by USE of an internal SERVER Path Link, as shown, when checking your HREF-Line:
>> /gymcart/\"
https://www.youtube.com/embed ... <<
Ernie
Re: is it possible to use external image link for the produc
Posted: Thu Jan 07, 2016 6:11 pm
by chardon
I tried this for OC 2.1.0.1 but I got an error, please what is the updated version for 2.1.0.1 for image.php?
Warning: getimagesize(/home/b1102/public_html/image/
https://storefront.com/Commerce/imageCo ... TDR250.jpg): failed to open stream: No such file or directory in /home/b1102/public_html/catalog/model/tool/image.php on line 26Error: Could not load image /home/b1102/public_html/image/
https://storefront.com/Commerce/imageCo ... TDR250.jpg!
Re: is it possible to use external image link for the produc
Posted: Fri Jan 08, 2016 9:12 am
by IP_CAM
1. this cannot work, you have a linked placed after the internal Server Path.
2. This is NO Opencart v.2.x Code, you display above.
Ernie
openshop.li/cart/
Re: is it possible to use external image link for the produc
Posted: Fri Jan 08, 2016 9:25 am
by chardon
It's the error I got in my open cart 2 admin while logged into opencart. I tried import/export open cart extension with image http:// link after I added this code below to my image.php
public function resize($filename, $width, $height, $type = "") {
if (substr($filename, 0, 7) == 'http://') {
return $filename.'" height="'.$height.'" width="'.$width;
} elseif (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
}
Re: is it possible to use external image link for the produc
Posted: Fri Jan 08, 2016 11:14 am
by chardon
It;s an error with the file path....it's including the server path along with the http://
Re: is it possible to use external image link for the produc
Posted: Fri Jan 08, 2016 12:47 pm
by IP_CAM
it's not an error, you are addressing the
PATH, by USE of
DIR_IMAGE, instead of
HTTP linking by using
HTTP_IMAGE, because then, it would work, I assume, anyway
Ernie
Re: is it possible to use external image link for the products?
Posted: Wed Apr 19, 2017 6:40 am
by hillfingerr
I am using Opencart 1.5.6.4 and for the below code works to use both external and internal images, but unfortunately it has two issues:
1. for the external images, I can't use https urls and for my ssl site this causes mixed content errors and the connection is not secure anymore and seo suffers.
2. if any additional images are clicked, they follow the link to the external source instead of the normal behavior to show the large image on my site.
Is there anyone knowledgeable in php and willing to help to revise the code so these will be fixed?
MicroCNC wrote: ↑Tue Dec 10, 2013 1:41 pm
replace catalog/model/tool/image.php line 16
with
Code: Select all
if (substr($filename, 0, 7) == 'http://') {
return $filename.'" height="'.$height.'" width="'.$width;
} else {
return;
}