Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Join Date
    Feb 2010
    Posts
    41
    Plugin Contributions
    0

    Default Re: Using external images

    I just did this on a site because the customer was always having to update there site with the new images that were always changed by the manufacturer. There is also the fact that even with the steps above it was to much work for the customer.

    I found an old thread on here where they talked about it in 2008 but some of there information was very outdated and since there was so many new changes I was able to do this very easy with only editing 1 file in a non-destructive way. If you try the way other posts say then it will work but your banner images will also be effected because they are all using the same HTML coding.

    Here is what I did:
    All edits are on - root/includes/functions/html_output.php

    Step #1
    First you have to edit the zen_image_OLD() function because you are going to use this to call in your images.
    Find:
    $image = '<img src="' . zen_output_string($src) . '" alt="' . zen_output_string($alt) . '"';

    Right above that add this line of code
    //This cuts images/ out of the string when you are calling an external image
    $src = substr($src, 7);

    Step #2
    Find the zen_image() function and look for:
    if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {

    Add to the end of that string the http check:
    if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0' or stristr($src, 'http') != '0' ) {

    That's it, now the site should be unaffected but when you call a external image with a http in front of it the code will use the other function removing the images/ part of the string. I have not tested this on more then products and banners and I am not sure where zen_image_OLD() is called. I did a simple search for it in the developer tool kit and did not find it. You could also just copy all of it and rename the function so that there is no interference at all.

  2. #12
    Join Date
    Feb 2010
    Posts
    41
    Plugin Contributions
    0

    Default Re: Using external images

    I forgot to mention that you have to add in enough space for the URL address in the database. Just put this in the "Install SQL Patch" under tools in the admin.

    ALTER TABLE `products` CHANGE `products_image` `products_image` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

  3. #13
    Join Date
    Feb 2010
    Posts
    41
    Plugin Contributions
    0

    Default Re: Using external images

    How embarrassing if you do this the images from your template will no longer show. Here is the fix so only the 'http' images get cut off.

    if(stristr($src, 'http') ){
    //This cuts images/ out of the string when you are calling an external image
    $src = substr($src, 7);
    }

  4. #14
    Join Date
    Feb 2010
    Posts
    41
    Plugin Contributions
    0

    Default Re: Using external images

    Going to have to still work on this one.
    With the lightbox plugin installed the image will not come up. It works fine but will distort the image size because zen cart sets sizing.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. linking to external images, outside of 'images/'
    By emphatic in forum Templates, Stylesheets, Page Layout
    Replies: 31
    Last Post: 7 Apr 2014, 10:48 AM
  2. Using banners on external site
    By odessey1 in forum Basic Configuration
    Replies: 6
    Last Post: 6 Jan 2010, 09:00 PM
  3. Using external email newsletter system
    By mtndan in forum General Questions
    Replies: 10
    Last Post: 20 Sep 2009, 03:23 AM
  4. Using external IP address to host site
    By Meshach in forum General Questions
    Replies: 1
    Last Post: 2 Jun 2009, 11:48 PM
  5. Using external http: links for main product images?
    By smoke133 in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 17 Feb 2009, 08:17 PM

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