Forums / Templates, Stylesheets, Page Layout / linking to external images, outside of 'images/'

linking to external images, outside of 'images/'

Started by emphatic on 29 Dec 2006, 4:28 AM · Views: 20,803

Results 21 to 32 of 32
9 Mar 2010, 12:24 AM
#21
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

linking to external images, outside of 'images/'

That's the base /images/ folder, directly in your store's folder.
Using a folder named /LRG/ to hold product images is probably not the best idea, as "large" images are to be placed in the /images/large/ folder as versions of the "small" basic images in the /images/ folder. If you want a set of images that are specifically for off-site use, name the folder /froogle/ or something. If the images are the large versions of your regular product images, they should be in the /images/large/ folder and named with the _LRG suffix (like myimage_LRG.jpg, where the base image is myimage.jpg).
You might want to read up on image use in the tutorials before you do something that will cause grief down the road.

15 Mar 2010, 11:16 PM
#22
riky avatar

riky

New Zenner

Join Date:
Dec 2009
Posts:
59
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

webejant:

Hello,

I just migrated here from OsCommerce where I linked to external images for my products through a contribution I found and it worked perfectly. I am now using Zen Cart and have not figured out how to do it with Zen Cart. I found this post, but, as a "newbie" to Zen, I needed simple copy and paste instructions, so, this post did not help as of yet. The following is what I did in OsCommerce, and yes, I am aware that Zen and OsC are different, but, will something similiar work? And if so, can someone give me a simple copy and paste to make it work? And yes, I have permission from my online supplier to link to their image server, so, no etiquette is compromised.

1.) Open catalog/includes/configure.php

add the following line of code to the end of the file before the last ?>

define('DIR_EXT_HTTP', 'http://');

2.) Open catalog/product_info.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

3.) Open catalog/includes/modules/new_products.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

4.) Open catalog/includes/modules/product_listing.php

find the following line

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

and replace with

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_EXT_HTTP . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

5.) Open catalog/includes/boxes/whats_new.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

6.) Open catalog/includes/boxes/specials.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

7.) Open catalog/includes/boxes/best_sellers.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

8.) Open catalog/popup_image.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

9.) Open catalog/shopping_cart.php

find the following line

DIR_WS_IMAGES

and replace it with:

DIR_EXT_HTTP

It is best to follow the above replacements for all boxes files used on your site.

Thanks in advance,
WeBeJanT

Hi ,

I did that but doesn 't work . Because if you change the DIR_EXT_HTTP . It keeps looking on your internal server...
Any other solution?

19 Mar 2010, 4:55 PM
#23
goldbrick avatar

goldbrick

New Zenner

Join Date:
Mar 2010
Posts:
3
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

micmed:

I got this to work. Wherever there was a line number referenced I looked to see if there was similar code. If there was, then I replaced it with the code from the contribution. If there wasn't similar code then I inserted it at or near the code line that was referenced. Be sure to include comments and test after each change.

I had to change the length of the database field "products_image". I set mine to 128 characters.

My question now is how do I now get multiple images to display in the product page? For starters, I have created new database fields called "products_image02", "products_image03" etc. Using EP I have uploaded the URL's of the additional images and I can see them in the database fields. I do not know how to call them from the database to display in product page.

Here is the site: http://www.micmed.com/simpsoncycles/

The image names come from another application, so using common basename+ consecutive numbers will not be practical. The images HAVE to served from another location. There are hundreds of items that will be uploaded each week. There are 10 image field URL's that will be uploaded for each item via EP.
The main page images are local. The additional images on the product page are in the HTML, but my client does not want to have to insert them into the HTML product description.

I had an email exchange with the author. They were just experimenting with this about 4 years ago and has since moved away from PHP programming.

I have changed the code but I cannot find the spot to change the database to take longer entries (I need my picture URL to be 128 characters). Could someone please help me?

12 Apr 2010, 6:24 PM
#24
riky avatar

riky

New Zenner

Join Date:
Dec 2009
Posts:
59
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

You have to change it in your phpAdmin.

Anyway . I still have the same problem!

12 Jan 2011, 9:03 PM
#25
savchenko01 avatar

savchenko01

New Zenner

Join Date:
Nov 2010
Posts:
16
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

How do we link external images to remote server? Do you have code that works? If you do could you please let me know the code? Preferably copy and paste or zip it if you can. I’m new to Zen Cart (php). Looks like many people have the same problem. Also, I’m authorized to use my supplier images. Thanks!

11 Mar 2011, 2:14 PM
#26
remiales avatar

remiales

New Zenner

Join Date:
Feb 2011
Posts:
5
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

Hello!

All the pictures on my website is liked to the supplier (http://www.supplier.com/imagens/photo.jpg). But when i go online i am not able to see the pictures unless i do a right click on the picture and choose to "view image". If i do that for one all the rest will show too.

I tested on IE, FF and Safari and happen the samething.

I changed the DIR_WS_IMAGES path

Do you have any idea what can i do?

Thank you in advance.

23 May 2011, 9:07 PM
#27
sigp220 avatar

sigp220

New Zenner

Join Date:
Dec 2010
Posts:
25
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

savchenko01:

How do we link external images to remote server? Do you have code that works? If you do could you please let me know the code? Preferably copy and paste or zip it if you can. I’m new to Zen Cart (php). Looks like many people have the same problem. Also, I’m authorized to use my supplier images. Thanks!

Linking to external distributor websites is very common. It is NOT hot linking contrary to what some may think. Web services , eg. XML via PHP SOAP is required by some distributors. Some may not realize the fact that when you use PayPal for example, you are using SOAP to access their database.

Almost all distributors use the same manufacture images. Distributors WANT you to link to their websites for the most up to date data INCLUDING Images.

Zen Cart Moderators need to understand that this is a LEGITIMATE and SMART way of doing business.

Sorry, Done ranting now.

I suggest: The first thing that needs to be done is to backup your database. Second, Patch the database Image field to accept more length.

Insert this code into: Admin CP> Tools> Install SQL Patches.

ALTER TABLE products CHANGE products_image products_image VARCHAR( 150 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

The rest is simply a matter of cutting and pasting code from the WIKI contribution. Search using Developer Tool Kit for all PHP Modules and Templates. Find: DIR_WS_IMAGES and replace with: DIR_EXT_HTTP. There may be 20 or more files that need to be changed.

BTY there is a free Zen cart Module Contribution that will install exactly what you need. pro-webs.net

4 Jul 2011, 2:16 PM
#28
klevans avatar

klevans

New Zenner

Join Date:
Jul 2011
Posts:
27
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

Hi

I know this is a bit of a old thread but I had problems with the New zen and this and found only altering one file

html_output.php and added this to line 170

// use old method on template images  by rl: test for http
if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0'  or strstr($src, 'http') != '0' ) {
  return zen_image_OLD($src, $alt, $width, $height, $parameters);
}

Worked fine on all pages as it was not working on every one before.

30 Aug 2011, 4:07 AM
#29
jewelsnpearls avatar

jewelsnpearls

New Zenner

Join Date:
Feb 2011
Location:
Hong Kong
Posts:
29
Plugin Contributions:
1

Re: linking to external images, outside of 'images/'

I checked on the following link in ehow:
http://www.ehow.com/how_8759326_modify-cart-use-external-images.html

The explanation is pretty straightforward. Basically: replace every occasion of DIR_WS_IMAGES by DIR_EXT_HTTP.

If your local images have the full URL then they are found as well.

I want to use a subdomain (http://images.jewels-n-pearls.com).

Please correct me when I'm wrong: in that case using:
define('DIR_EXT_HTTP', 'http://images.jewels-n-pearls.com/'); would work?

21 Sep 2011, 7:49 AM
#30
lenpilot avatar

lenpilot

New Zenner

Join Date:
Apr 2011
Location:
Colonial Beach Virginia
Posts:
10
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

I have had to piece this together from several posts so for the benefit of those searching, here it is in full. This method is assuming a fresh install. Works like a charm. (Video Tutorial on you-tube. Search external images Zen Cart) Do not use this method on a secure installation as you will get errors from the images.

Step 1
Find: DIR_WS_IMAGES and replace with: DIR_EXT_HTTP in every file of your zencart distribution and any template.
Now upload and run your install

Step 2
Line 29 on /includes/configure.php reads
define('DIR_EXT_HTTP', 'images/');
Change this to:
define('DIR_EXT_HTTP', '');
Note the page here doesn't show well so just remove images/ only from that line leaving ' ' intact.

Step 3
Open /includes/functions/html_output.php and replace what is there (and looks a lot like this) with this new code probably found at line 166-170

// use old method on template images by rl: test for http if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0' or strstr($src, 'http') != '0' ) { return zen_image_OLD($src, $alt, $width, $height, $parameters); }

Step 4
Insert the following code into: Admin CP> Tools> Install SQL Patches.

ALTER TABLE products CHANGE products_image products_image VARCHAR( 150 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

Your zen Cart will now display external images. I have used this method to load thousands of products with hotlinked images since that is the only way the supplier will have it.

7 Apr 2014, 9:38 AM
#31
refinerztouch avatar

refinerztouch

New Zenner

Join Date:
Mar 2014
Location:
USA
Posts:
10
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

I have completed my store now all I want is to add external links to catalog image so that customers can see the product description. any help plz!!!

7 Apr 2014, 9:48 AM
#32
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: linking to external images, outside of 'images/'

refinerztouch:

I have completed my store now all I want is to add external links to catalog image so that customers can see the product description. any help plz!!!Well you could just put the link to the external site in your product description.
Adding a user defineable link to the product_image is going to take a LOT of work :(
I mean farrrrr toooo much.

Why not host it on your site?
Cut and paste the external product_description and use it for your Product_description
Then at least you won't be promoting "other" sites for google to rank in front of yours