Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2019
    Location
    UK
    Posts
    70
    Plugin Contributions
    0

    Default Storing images on a different server?

    Hi

    Is it possible to make a configuration change so that all new images added to the database are stored on a different server.?

    My zen-cart currently runs on digi-books.org.uk but we are migrating to an unlimited host at digi-books.org.

    So what I am asking is when we add an author or a book cover can that be stored on the latter server automatically?

    Thanks in advance

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Storing images on a different server?

    Unfortunately it's rather complicated to do that.

    Zen Cart dynamically detects what product/category images are available, including small/med/large sizes, based on what files are present in the server's actual filesystem. Hosting the images externally means it has no insight into what's available.

    To do it would require rewriting all the image-related code to ignore all the optimizations that it currently handles, and rely strictly on a URL to an external image, regardless of that image's dimensions or resolution or suitability.

    Can it be done? Sure. You have full control over the code on your server, so you could add a image-url field to your product table in the database and then everywhere all your template files produce an image you can use that stored URL instead. Many of the template files rely on the image-related lookups happening before the template is called so you'd need to edit/replace that code in the header_php or main_template_vars.php files for every page.
    Alternatively you could intercept the usual image-related code by declaring a custom handle_image() function that handles all the lookup/retrieval logic for your specialized image processing. Keep in mind that you'll need to do some fancy stepping to assess what kind of image is being requested in order to lookup the proper external image you're trying to load (size, dimensions, resolution, etc) to replace what Zen Cart does dynamically when looking for multiple-sized images directly on the filesystem.
    .

    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
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Storing images on a different server?

    @OwenB,
    Since there is this migration occurring, am I correct that at some point what would now be considered a remote server would become the local server?

    Or was the thought to always "split" this information so that images remained on the one server while the store remained on the other and migration would be more of a data storage situation?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v139h 2 different sites on same server but want to use same product images
    By ultravires in forum General Questions
    Replies: 10
    Last Post: 4 Apr 2013, 08:16 PM
  2. what is the proper folder for storing images?
    By idc1 in forum General Questions
    Replies: 3
    Last Post: 11 Jul 2011, 02:20 PM
  3. Where should I be storing my product images?
    By Beama in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 22 Jul 2009, 05:48 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR