Forums / Templates, Stylesheets, Page Layout / Remove http://mysite/ from images ??

Remove http://mysite/ from images ??

Started by ehtats on 21 Feb 2012, 7:25 PM · Views: 1,327

Results 1 to 12 of 12
21 Feb 2012, 7:25 PM
#1
ehtats avatar

ehtats

New Zenner

Join Date:
Mar 2005
Posts:
11
Plugin Contributions:
0

Remove http://mysite/ from images ??

I am trying to do something I'm not sure can even be done. I'd like to remove the http://mysite/ from my product images. For instance, when checking the properties for a product image (right click and select properties) I would come up with http://mysite/images/product_image.gif I would like to remove the http://mysite so I would only have the images/product_image.gif (I already know how to remove the images/ .... that part was easy :)

I've been searching like crazy but can't come up with a solution. I've tried configuration files and product files etc etc and just can't find the correct code to alter.
Any suggestions ?
Thanks

Steve

21 Feb 2012, 7:40 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Remove http://mysite/ from images ??

First question - what problem are you trying to solve with this idea ?

21 Feb 2012, 7:48 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Remove http://mysite/ from images ??

Your browser is adding that, not Zen Cart.
If you look at the raw HTML by right-clicking the page (not the image) and choose View Page Source, then you'll see that the images do not have the full domain added to them.

So, as stevesh has also asked, the more important thing here is ... WHY are you even asking this question? What's the business problem you're trying to solve?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Feb 2012, 8:43 PM
#4
ehtats avatar

ehtats

New Zenner

Join Date:
Mar 2005
Posts:
11
Plugin Contributions:
0

Re: Remove http://mysite/ from images ??

I use easy populate and if I could remove the http://mysite from the URL then I could link directly to my warehouses images. I have a site that I am putting up with about 12,000 different drop ship products and I'd really really hate to have to upload them all to my server. Plus the images are constantly being changed/updated and if I just direct link to them the images on my site would always be current.

I understand that the browser is putting in the http:// part, but isn't Zen Cart putting in the 'mysite' part? If I could easily change the 'mysite' to 'mydropshipperssite' then the remote image URL links would work ............ I hope!
Thoughts ????

Steve

21 Feb 2012, 9:32 PM
#5
rescoccc avatar

rescoccc

Totally Zenned

Join Date:
May 2010
Location:
WA State
Posts:
1,700
Plugin Contributions:
2

Re: Remove http://mysite/ from images ??

I understand that the browser is putting in the http:// part, but isn't Zen Cart putting in the 'mysite' part?

Zen uses relative links so, no, it isn't adding the mysite part - technically, anyway. The cart looks at your configure.php file for the path to your images. I'm not sure if it'll work, but you may be able to edit that file and change the path to point to your external image source.

The best way to learn is to try stuff. But, back it up first.

21 Feb 2012, 9:37 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Remove http://mysite/ from images ??

Zen Cart looks for physical files on your server, and does a whole lot more than merely output an img tag for the images.

If you want to host your images someplace else, the FIRST thing you need is clear official permission to ensure you're not violating copyright laws, and then you need to rewrite the image handling infrastructure in Zen Cart to no longer offer multiple images per product, no longer handle intelligent resizing of images, no longer offer click-for-larger-image capability, etc.

Merely changing a path in configure.php isn't going to accomplish all of that.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Feb 2012, 10:25 PM
#7
ehtats avatar

ehtats

New Zenner

Join Date:
Mar 2005
Posts:
11
Plugin Contributions:
0

Re: Remove http://mysite/ from images ??

Yes I have permission from the warehouse, they are sending me a disc with the images right now. Just figured that pointing the URL to their site is the easier way.
Being that I can't easily change the code to point to an external URL does anyone know of a mod that will do this? I've searched and searched and only came up with a few suggestions that people said would work, but it didn't work for me. They had said to change the DIR_WS_IMAGES (in the config file) to something else that would point to an outside host, except it never did actually work.
Guess I will keep chugging away at it, there has to be a solution out there somewhere!

Steve

22 Feb 2012, 2:46 AM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Remove http://mysite/ from images ??

As DrByte said, the solution to what you say you want is to do a massive amount of custom coding, and then accept the loss of a number of commonly-used image features.

22 Feb 2012, 3:53 AM
#9
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: Remove http://mysite/ from images ??

Before you would link to the images from the warehouse, you might want to ask them if they want you chewing through their bandwidth rather than your own......

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

23 Feb 2012, 4:04 PM
#10
ehtats avatar

ehtats

New Zenner

Join Date:
Mar 2005
Posts:
11
Plugin Contributions:
0

Re: Remove http://mysite/ from images ??

OK, I figured it out (by saying 'I' what I really mean I found a post and made it work) ...... I can't take credit for it.

I changed the file includes/functions/html_output.html

Look for this string on or around line 165

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

This string will be replaced with this new code

//by rl if image is located on the web, strip any local path
if (strstr($src, 'http') != '0') {
$src = strstr($src, 'http://');
}

// 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);
}

SO - The file will now look something like this (with the new code)

/*

  • The HTML image wrapper function
    */
    function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
    global $template_dir, $zco_notifier;

    // soft clean the alt tag
    $alt = zen_clean_html($alt);

    //by rl if image is located on the web, strip any local path
    if (strstr($src, 'http') != '0') {
    $src = strstr($src, 'http://');
    }

    // 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);
    }

//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}

With the new code the images will be picked from an outside server ONLY if you entered the picture name (when adding new products) with an http://

From what I understand is that this new code addition will look for the http:// in the product image description entered and remove the http://mystie.com/images/ from the Zen Cart default picture URL when it sees it.

NOW, that being said ..... and nothing EVER works easily for me ..... my warehouses images will not work with the http:// , the URL must be with out it. Example is if the URL is http://www.ware_house.com/images/product1.img the image wont show. It has to be www.ware_house.com/images/product1.img to work correctly. I am still messing with the new code addition to make it work.

Steve

23 Feb 2012, 4:52 PM
#11
ehtats avatar

ehtats

New Zenner

Join Date:
Mar 2005
Posts:
11
Plugin Contributions:
0

Re: Remove http://mysite/ from images ??

Correction to the last post. As I am playing with the code an image from my warehouse WILL show up on a regular browser with the http:// ..... I was checking the image in Google Chrome and Chrome automatically strips the http:// from the URL. When I entered the URL with the http:// in Internet Explorer the image will show up correctly with the full URL link.
I've tried many images that I tested from the web and everything works perfectly ...... EXCEPT for the images from my drop ship warehouse ... lucky me I guess.
Onward and forward!

Steve

23 Feb 2012, 8:12 PM
#12
rescoccc avatar

rescoccc

Totally Zenned

Join Date:
May 2010
Location:
WA State
Posts:
1,700
Plugin Contributions:
2

Re: Remove http://mysite/ from images ??

I've tried many images that I tested from the web and everything works perfectly ...... EXCEPT for the images from my drop ship warehouse ...

They may have hotlinking protection in place.

The best way to learn is to try stuff. But, back it up first.