Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Best way to implement external image server?

    I know it's a bit of a weird request.. but I have my reasons :)

    I'd like to keep all the code and template info on the main server, but have all the product images load from another web server. Can anyone think of an easy way to do this?

    My thought was to set up another config setting called:
    define('DIR_EXT_IMAGES_SRV', 'http://www.myimageserver.com/');

    but that would mean I have to go into all files that call DIR_WS_IMAGES and prefix it to the new config variable.

    Any other thoughts?

    I also realize that when the store goes into ssl mode I'm going to need a way to put the images in to ssl server mode so that I dont get the IE error. I'll have to think about that one too.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Best way to implement external image server?

    ... and you're going to have to come up with a creative way to get the IE7 privacy warnings to not show.


    Zen Cart does not currently support externally-hosted images. There are a significant number of places in the core code files which would have to be changed to make this happen, and this hasn't been implemented at the present time.
    .

    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.

  3. #3
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Re: Best way to implement external image server?

    Quote Originally Posted by DrByte View Post
    ... and you're going to have to come up with a creative way to get the IE7 privacy warnings to not show.


    Zen Cart does not currently support externally-hosted images. There are a significant number of places in the core code files which would have to be changed to make this happen, and this hasn't been implemented at the present time.
    well i know that it would take some effort.. i can do it.. i just wondered if there was a better way.

    Actually I wonder if i add a database field for the add new product area to have image location and give the option to upload an image like it does now, or enter the url of the image and save that path in the db.

    Then I would have to seperate the domain from the image path so I could set it to use the https or http. You mention IE7 privacy? I thought it only asked "Do you want to display both secure and non-secure items?" . If the images are pointed to a secure server.. would they still show that message? .. hmm i guess they might show some similar message since the ssl cert would be from a diff host..
    Last edited by qhome; 17 Jan 2007 at 08:20 PM.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Best way to implement external image server?

    DIR_WS_IMAGES is used pretty much universally, for non-template-specific images.
    Are you proposing to serve only product-related images externally, or *all* images, including categories, file-uploads, and more?

    Depending on how you intend to do it, it might be easier to simply hook the functions that "display" the image to have them do a replacement of the path with the URL, perhaps after checking whether the local version of the image file exists.
    .

    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.

  5. #5
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Re: Best way to implement external image server?

    Quote Originally Posted by DrByte View Post
    DIR_WS_IMAGES is used pretty much universally, for non-template-specific images.
    Are you proposing to serve only product-related images externally, or *all* images, including categories, file-uploads, and more?

    Depending on how you intend to do it, it might be easier to simply hook the functions that "display" the image to have them do a replacement of the path with the URL, perhaps after checking whether the local version of the image file exists.
    Ya. just product images.. your idea sounds like a viable one.

  6. #6
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Re: Best way to implement external image server?

    ok so i ran a little test on my main server in ssl mode, and added
    <img src="http://imageserver.com/image.jpg" /> to the header. As expected it gave the error about "secure and non-secure" items. But then i changed the code to:
    <img src="https://imageserver.com/image.jpg" /> and no error! So it doesnt seem to care that its on another server with a different ssl cert I guess, so long as it is secure. That takes care of my main worries.

  7. #7
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Re: Best way to implement external image server?

    Had an idea last night...
    Not sure if it will work but it might be easiest.

    Currently i just changed the config for DIR_WS_IMAGES from /images/ to the full path of the image server.. and that works fine.

    I was thinking, on pages that are SSL, i could re define that constant/variable to add the "s" at the end of http for secure layer.

    Could someone explain to me the way the ssl check works and if I should maybe add that to a function or to the top of certain pages like login, checkout, etc... Might be a quick n dirty work around.

  8. #8
    Join Date
    Dec 2006
    Posts
    27
    Plugin Contributions
    0

    Default Re: Best way to implement external image server?

    Did you figure out how to use external images? www.theoutfitladies.net/cart are all external images....let me know and I will tell you what to do ...its very easy......after someone fixed some codes for me.

    Blain

  9. #9
    Join Date
    Feb 2004
    Posts
    1,774
    Plugin Contributions
    14

    Default Re: Best way to implement external image server?

    Quote Originally Posted by blainbci View Post
    Did you figure out how to use external images? www.theoutfitladies.net/cart are all external images....let me know and I will tell you what to do ...its very easy......after someone fixed some codes for me.

    Blain
    Ya, as I mentioned in the previous post I got non-ssl images working simply by changing the DIR_WS_IMAGES in the configure.php file to the external server. But I noticed you don't use SSL on your site so you probably don't have a way of switching to an SSL version of the image server when on SSL pages?

  10. #10
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Best way to implement external image server?

    $request_type is a variable that will be set to 'SSL' or 'NONSSL' depending on the current page configuration. It is set during the init_System load process via init_file_db_names.php
    .

    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 22 Aug 2010, 11:08 PM
  2. How to implement an external stylesheet for my menu?
    By zingslings in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 27 Apr 2009, 11:53 PM
  3. best way to implement captcha for contact-us form??
    By tlyczko in forum General Questions
    Replies: 2
    Last Post: 14 Apr 2008, 05:13 PM
  4. how to best implement a free sample?
    By eddierosenthal in forum Setting Up Specials and SaleMaker
    Replies: 2
    Last Post: 6 Sep 2007, 12:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg