Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Absolute image paths

    Hi

    When I have an absolute path for the products_image column the product info page displays it incorrectly as it tries to add a relative path infront of it like so

    <img src="images/http://domain.com/someimagefile.jpg" />

    because not all of my images will be absolute I cannot simply change DIR_WS_IMAGES to nothing.

    Basically I just want to write a little bit of code to say that if producs_image starts with http or https then do not add DIR_WS_IMAGES infront of it, but I've been searching for hours and could not find where in the code to do this?

    Thanks

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Absolute image paths

    So essentially you are wanting to have (some of) your product main images hosted offsite?

    I don't think you are looking at a "little bit of code". You are wanting to fundamentally change the way Zen Cart accesses images, some of the time. There are references in many places that use DIR_WS_IMAGES, and you would have to write alternates for all of them.

  3. #3
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Absolute image paths

    hmm what's the best way to go about this then?

  4. #4
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Absolute image paths

    Nobody knows? I thought this would have been a common feature that people would have requested before, I've tried doing a search but no relevant posts have came up, strange.

  5. #5
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Absolute image paths

    You are going to have more trouble than it is worth in most cases to have images hosted off of your Zen Cart site. It is not built in.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  6. #6
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Absolute image paths

    Ok I've found a solution myself. This fixes all pages as it is used in the actual zen_image function itself

    in this file includes/functions/html_output.php

    paste this code on line 163

    PHP Code:
    if (preg_match("/^".str_replace("/","\/",DIR_WS_IMAGES)."http/i",$src)) {
        
        
    $src preg_replace("/^".str_replace("/","\/",DIR_WS_IMAGES)."http/i","http",$src);
        


 

 

Similar Threads

  1. Absolute Paths prevent facebook scraper to access the pages
    By flernebunu in forum General Questions
    Replies: 14
    Last Post: 24 Apr 2013, 01:51 PM
  2. Generate images with absolute paths
    By damiantaylor in forum General Questions
    Replies: 3
    Last Post: 5 Sep 2012, 01:10 PM
  3. Image paths in language files
    By mattys in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 Dec 2006, 06:25 PM

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