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 1 to 20 of 32
29 Dec 2006, 4:28 AM
#1
emphatic avatar

emphatic

New Zenner

Join Date:
Dec 2006
Posts:
3
Plugin Contributions:
0

linking to external images, outside of 'images/'

I am having a small problem. I was able to link to external images (commercially hosted), by putting the URL in the products table in the product_image field. Then by editing the '$src' variable in the 'zen_image' function, (use the developer toolkit to find it, then use the php function str_replace() to strip DIR_WS_IMAGES from the $src variable), I can get the product pictures to show in all places but the main product page (inside of <!--bof Main Product Image -->). What I'm wondering is why the developer's use javascript to serve the php code that puts the product photo on the product detail page?

btw the popup works and shows the picture as well. Also, the <img> tag is formatted properly and should work since the src attribute is the correct one in the final HTML output.

I'm assuming it's a load order issue.

Any suggestions.

29 Dec 2006, 6:02 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

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

My suggestion is one of web ettique...it is not normally nice and in some cases allowed to steal another websites bandwidth serving images to your site. Consider, if you have your site setup this way and they configure to dis-allow linking...BAM your site is compromised. JMO

Zen-Venom Get Bitten

29 Dec 2006, 1:36 PM
#3
emphatic avatar

emphatic

New Zenner

Join Date:
Dec 2006
Posts:
3
Plugin Contributions:
0

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

i'm sorry, maybe I wasn't completely clear. THE IMAGES ARE COMMERCIALLY HOSTED! As I mentioned in my original post. This means I have PAID for them to be hosted REMOTELY. Also please notice that I mention the picture SHOWS UP everywhere else but the main product page. (if it were a hotlink protection issue, none of the pics would be showing) Sorry for confusing you. :smartass:

Anyone else???

btw, a lesson in web ettiquette, it is customary to READ THE ENTIRE POST, twice if neccessary for clarity. (I mean you basically accuse me of theft, even though my post says otherwise ... uncouth to say the least.)

29 Dec 2006, 5:08 PM
#4
emphatic avatar

emphatic

New Zenner

Join Date:
Dec 2006
Posts:
3
Plugin Contributions:
0

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

Should haveknown it would be something simple!!!!! The URL's involved are so long, I hadn't noticed that Zen appends things to the product_image field. (For me the appended text is _MED. I've seen this mentioned in a few places in the forum as well.) Should be simple to fix.

Fixed. Same fix as above. Thanks anyway.

1 Jan 2007, 10:37 PM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

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

emphatic,

btw, a lesson in web ettiquette, it is customary to READ THE ENTIRE POST, twice if neccessary for clarity. (I mean you basically accuse me of theft, even though my post says otherwise ... uncouth to say the least.)
Sorry that you took this personally, I was referring to "bandwidth" and this is done, and probably too much.
I was able to link to external images (commercially hosted)
Reading 50 times would not have altered my post as you only state "commercialy hosted", and this can refer to any images that are on the web as I consider all my sites to be commercially hosted as are the images. I know now, that you knew what you meant and hope that you can see that this is not fully clear by what you stated.

Zen-Venom Get Bitten

25 Jun 2009, 7:32 PM
#6
tami5 avatar

tami5

New Zenner

Join Date:
Jun 2009
Posts:
5
Plugin Contributions:
0

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

CAn someone explain exactly how this is done and where to make the changes? I have the same need -external images.

2 Jul 2009, 2:35 PM
#7
webejant avatar

webejant

New Zenner

Join Date:
Jun 2009
Posts:
1
Plugin Contributions:
0

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

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

21 Dec 2009, 11:22 PM
#8
mb01a avatar

mb01a

New Zenner

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

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

webejant:

Hello,

I just migrated here from OsCommerce where ...

I didn't want to quote the entire post, since I might chew up some extra bandwidth. I'm using Zen Cart 1.3.8a and also need to use external images.

The product images I need to use are located on a separate server and although I am allowed to use them, I must link to them - not copy them to my server. Rules are rules .. I just do whatever comes next.

So, if anyone has solved this issue or knows that the changes indicated in webejant's post will work ok with Zen Cart could you please let us know?

Thanks.
Mike
:yes:


zen-cart-v1.3.8a
12/15/2009

23 Dec 2009, 6:46 PM
#9
micmed avatar

micmed

Zen Follower

Join Date:
Mar 2008
Location:
The Free South
Posts:
165
Plugin Contributions:
0

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

Welcome!

I was successful using this method:

http://www.zen-cart.com/wiki/index.php/Contribution:Web_images

I however need to be able to display multiple images on the product page.

Here is the thread that I describe it in:

http://www.zen-cart.com/forum/showthread.php?p=821361#post821361

www.theCableStation.com
"If we restrict liberty to attain security we will lose them both."

24 Dec 2009, 5:31 PM
#10
alexiss avatar

alexiss

New Zenner

Join Date:
Jun 2009
Posts:
63
Plugin Contributions:
0

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

Do you know if this will work if i load my product using easy populate?

Thanks lexxie

25 Dec 2009, 4:02 PM
#11
alexiss avatar

alexiss

New Zenner

Join Date:
Jun 2009
Posts:
63
Plugin Contributions:
0

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

micmed:

Welcome!

I was successful using this method:

http://www.zen-cart.com/wiki/index.php/Contribution:Web_images

I however need to be able to display multiple images on the product page.

Here is the thread that I describe it in:

http://www.zen-cart.com/forum/showthread.php?p=821361#post821361

Hi Dose anyone know how I can do this? I tried to figure this out but I just don't get it. http://www.zen-cart.com/wiki/index.php/Contribution:Web_images can some one explain to me if I am just adding the lines that are in this Contribution anywhere in the file it specefise it gose in. Dose it go in the top or bottm of the file. Where in the file dose it go. Or is it rplacing something in the file or am I just adding the code to the spesified php file. Can some one please explan to me how I can make this work for me to.

Thanks for your time and Help.

Lexxie

26 Dec 2009, 11:10 PM
#12
mb01a avatar

mb01a

New Zenner

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

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

I tried this today and can't make it work. When I impl'd it all images disappeared. I immediately restored my backup files and I can get images from my server normally just as before.

I know I've done something wrong, but I can't see what. I agree that for those of us who are not php gurus the implementation of a mod like this will be traumatic. Too many files to change, many changes in each file, no easy way to tell if a line should be replaced or the new lines just added. The implementation instructions could be more clear as to where to make the changes and if a change replaces an existing line or is an addition.

I use Notepad as my editor, so just giving me line numbers as a way to point to the change doesn't always come out right.

I did look at the author's website and it appears that he is able to get images from both his local server and use linked images from another server at the same time, so if he's using the same changes he posted in the wiki I guess we're too dumb to understand.

It's probably impossible to do, but if the author could zip up the live files needing changed from his website and let me look at them to compare to what I did, I'm sure I could make it work .. and also write sensible instructions that anyone could follow.

The best solution tho, would be for the Zen programmers to add this into their next point release and the entire issue would completely go away.

I promise that when I get more familiar with the Zen Programs (and PhP) I'll quit asking noob questions ..
:cry:


zen-cart-v1.3.8a
12/15/2009

26 Dec 2009, 11:28 PM
#13
mb01a avatar

mb01a

New Zenner

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

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

Just a note.

The original wiki article was posted on 4 November 2006. Since it's three years old I wonder if the changes are still valid for the current release of Zen Cart?


zen-cart-v1.3.8a
12/15/2009

28 Dec 2009, 8:25 PM
#14
micmed avatar

micmed

Zen Follower

Join Date:
Mar 2008
Location:
The Free South
Posts:
165
Plugin Contributions:
0

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

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.

www.theCableStation.com
"If we restrict liberty to attain security we will lose them both."

29 Dec 2009, 12:44 AM
#15
mb01a avatar

mb01a

New Zenner

Join Date:
Dec 2009
Posts:
5
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.

That's what I did. I probably didn't do my "inserts" in the same places you did. Most likely that's the problem.

Have you given any thought to sending the files you changed to me so I can look at them and then do a complete writeup of the implementation instructions?

micmed:

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

I made mine 256. (I know .. but that's what I wanted)

Not related to this, but I found that the product name field and the product description field were also too short for my use and were being truncated. I increased the size on them too.

micmed:

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.

Nice looking website! I don't ride, but I do appreciate sports cycles.

From what I see, making external images work with Zen Cart would be a major change. It's just not set up to allow external images.

I'm not a good PhP coder so I'm not the one to even think about it. expect that there are a lot of PhP gurus out there who could do it without much anxiety, tho ..

Thanks for responding. I've decided that if I can't make this "linked Image" thing work I'll upload all 10000+ images to my server and use them the Zen Cart way. The only other choice I have is to find a different shopping cart where 'bandwidth' is not so much of an issue ..
*(blatant reference to post number 2 in this thread)*grin

:blink:


zen-cart-v1.3.8a
12/15/2009

3 Jan 2010, 6:42 PM
#16
mb01a avatar

mb01a

New Zenner

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

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

I found another source for micmed's code. What he's posted is apparently not quite complete.

The code at tumblr.com/tagged/remote+images states:

tumblr site:

Basically you assign the constant DIR_WS_IMAGES to a variable $imagepath.

Then add the short method to check if the image starts with http.
If it does up then set imagepath to blank. else use DIR_WS_IMAGES.
You must also insert $imagepath in place of DIR_WS_IMAGES in the zen_image function calls.

**In addition to these files a number of other files need
to be updated. All products, featured, new, cart, listing, product info and maybe others. **

Make sure to pay attention to the file product being referenced
for example:
$featured_product->fields['products_image']
$new_product->fields['products_image']
$listing->fields['products_image']

etc.

The shopping cart also must be updated.

I have installed the micmed(tumblr.com) code (don't really know where it originated) on my test site and have everything working except Categories. When I click on a category, I get no products and no images for that category. I expect I have a few more files to modify.

Clicking on 'Specials', 'New Products', 'Featured Products', and 'All Products' works fine.

So .. I will continue looking and testing. When I have everything working ok, I'll post the results. If anyone would like to add anything to this, please do.

mike
:lookaroun


zen-cart-v1.3.8a
12/15/2009

24 Feb 2010, 5:31 PM
#17
monkeytown avatar

monkeytown

New Zenner

Join Date:
Nov 2007
Posts:
78
Plugin Contributions:
0

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

For the record, I just implemented micmed's code from his contribution page on the wiki and it worked perfectly (thanks). There are a few places where it isn't clear what to remove from the original code at first but just comment out anything in the original code that looks mostly the same as the code provided.

It should work fine with EP as long as your image field in your txt file contains the full path to the image (http://www.example.com/image.jpg). You may also need to increase the limit on your db field for products > products_image as mentioned above.

Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

8 Mar 2010, 7:56 PM
#18
helpmeplease avatar

helpmeplease

New Zenner

Join Date:
Oct 2009
Posts:
30
Plugin Contributions:
0

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

monkeytown:

image field in your txt file contains the full path to the image (http://www.example.com/image.jpg).

sorry for the stupid question....but I need to know how to find the path you mention above. I notice there are several "image" folders....in admin, in english, in my STORE's name. Question:

I do a manual upload to froogle (at their site), NOT using any zen cart mod. just want a STATIC unchanging url for each image. What folder should I upload my product images to?

Thank you in advance:bigups:

8 Mar 2010, 11:52 PM
#19
gjh42 avatar

gjh42

Black Belt

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

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

Any image located on your server will have a static URL, as the images are not moving from folder to folder.

Product images should generally go in the base /images/ folder or one of its subfolders.

9 Mar 2010, 12:15 AM
#20
helpmeplease avatar

helpmeplease

New Zenner

Join Date:
Oct 2009
Posts:
30
Plugin Contributions:
0

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

gjh42:

Any image located on your server will have a static URL, as the images are not moving from folder to folder.

Product images should generally go in the base /images/ folder or one of its subfolders.

Hi Glenn~

THANK YOU for caring enough to answer. I'm not sure what you mean by "base". I have created a new folder (and named it LRG), in the images folder located in my store's folder. Is it ok to upload my product images to where I have which is:

store/images/LRG/image01.jpg

Thank you so much...from this :frusty::lamo: to this :clap: