madmatt2006 Posted March 14, 2010 Posted March 14, 2010 Hello All :) Is there an add-on or some code modification I can use so a http://www.address can be used for my product images?
FIMBLE Posted March 14, 2010 Posted March 14, 2010 you are using images from another source outside of your own domain? You could use the HTML img tag Nic Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
madmatt2006 Posted March 15, 2010 Author Posted March 15, 2010 Thank you for the fast reply I really appreciate your help :) Yes that's what I'm doing. I'm also using the Easy populate mod to populate the site but there are thousands of images formatted like below. It would take for ever to add all the HTML img tag. Here are some example links http://images10.newegg.com/ProductImageCompressAll200/11-163-161-12.jpg http://images10.newegg.com/ProductImageCompressAll200/30-992-095-02.jpg http://images10.newegg.com/ProductImageCompressAll200/11-165-083-05.jpg http://images10.newegg.com/ProductImageCompressAll200/30-998-031-01.jpg http://images10.newegg.com/ProductImageCompressAll200/30-997-876-01.jpg http://images10.newegg.com/ProductImageCompressAll200/75-209-066-13.jpg
FIMBLE Posted March 15, 2010 Posted March 15, 2010 You could use the CONCATENATE function in Excel to do this, or the & operator in the formula I have added a zipped example for you to see what i mean Hope it helps Nic tags.zip Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
FIMBLE Posted March 15, 2010 Posted March 15, 2010 You could use the CONCATENATE function in Excel to do this, or the & operator in the formula I have added a zipped example for you to see what i mean Hope it helps Nic I forgot to mention when you copy the values from column D to paste into the Easy populate file, use right click >> Paste SPECIAL>> paste VALUES it might not work otherwise. Nic Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
madmatt2006 Posted March 15, 2010 Author Posted March 15, 2010 awesome thank you for your help I will give this a shot! there must be many others having this issue. I wish there was some type off add-on to handle this
FIMBLE Posted March 15, 2010 Posted March 15, 2010 its a pretty basic Excel function, and at least there is this post! I hope it helps you. Nic Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
madmatt2006 Posted March 15, 2010 Author Posted March 15, 2010 You have helped me a lot thank you Nic. your the man! :D
madmatt2006 Posted March 30, 2010 Author Posted March 30, 2010 Sorry to be a pain I have formatted the easy import files images are like this <img src="http://eu.chinavasion.com/images/Chinavasion-CVSCA-7000-2-0-sss-hhh.jpg"> but after the import the image is not there see here http://www.mypcmates.com/osc/product_info.php?products_id=33&osCsid=dcd29004d0cc47ff8bad5d39ee075dfc I must be doing some thing wrong I'm sure I'm doing what you told me. Got any ideas?
madmatt2006 Posted March 30, 2010 Author Posted March 30, 2010 Update: just found in the manual for the easy populate addon REMOTE IMAGES IMPORT You can import remote images just putting the url inside the image field. The image will be grabbed to the local images folder. You have two options: 1) Just putting URL of the file, ex: http://external.server.com/image.jpg . In this case the name of the image will be the same of the remote one. 2) Put name and URL together: image.jpg|http://external.server.com/get_image.php?id=qwerty . This is useful when you have not a file, but a script that outputs the image. I even tried method 1 by just putting the link in the import file and it seems to have the same issue what ever way I try got any ideas on why the images are not working through easy populate? If I add product manually the picture work with no problems has some thing to do with easy populate. Wonder if it's a bug with it..
madmatt2006 Posted March 30, 2010 Author Posted March 30, 2010 ok I have gone to the extent of setting up a fresh copy of OSC and installed the Easy populate fresh and I have the same problem. I'm 99% sure this is a bug with the easy populate mod it won't take web links for an image. Can some one confirm this issue please?
rogerwhitfield Posted May 27, 2010 Posted May 27, 2010 OK, I am not a php programmer, however I do dabble with simple code. From looking through the OSCommerce files it seems that whenever an image is called the path in the database is appended to the local server path and the images path, giving LOCAL_SERVER/IMAGES/IMAGE_FILE. "<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="lightbox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>" This only seems to happen in about 4 seperate files, would it not be possible to rewrite the image display code to read the first 4 characters of the image name from the database and if it starts with http then not append it to the local path/location? "if $product_info['products_image'] starts with "http" then display image else append DIR_WS_IMAGES . $product_info['products_image'] and diaplay end if" I am sure someone cleaverer than me can write a small update to allow this to happen?
knifeman Posted May 27, 2010 Posted May 27, 2010 Hello All :) Is there an add-on or some code modification I can use so a http://www.address can be used for my product images? I have not used this one, but I looked at it when developing my latest site: http://addons.oscommerce.com/info/4936 Again, not sure if it will work, but it does give info for use with EP. Tim
rogerwhitfield Posted June 5, 2010 Posted June 5, 2010 Ok Success, You can have both local and remote images at the same time. External images are not supported because your server and images location are prefixed to the image name, so if you use Easy Populate to import your items with the url set to something like 'http://remote.server.ip.address/image.name', this is prefixed inside the function tep_image. This can be rectified by editing /catalog/includes/functions/html_output.php Find the following:- //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) { return false; } Add immediately after:- // check to see if image is external or internal (check for http) and modify $src if ( substr($src,strlen(DIR_WS_IMAGES),4) == 'http') { $src = substr($src,(strlen(DIR_WS_IMAGES))); } This will check to see if the first 4 characters of the filename are 'http' if they are it will re-write the variable $src to remove the local server url and images directory, allowing OSCommerce to download the image from the remote server; this will cause additional traffic to the remote server so be sure you have permission to do this. Please note the click to enlarge link on my site has stopped working for all remote images since I made this alteration, I am using the UltraPics addon so I assume it is also looking for a local file, I will try and look into this unless someone else knows why this is?
rogerwhitfield Posted June 7, 2010 Posted June 7, 2010 This alteration breaks the pdf datasheet contribution, to fix it go to catalog/pdf/pdf_datasheet_functions.php and find $imagepath=/*DIR_IMAGE.*/$print_catalog_array['image']; comment out this line = //$imagepath=/*DIR_IMAGE.*/$print_catalog_array['image']; //removed to insert above and insert directly above:- // Mod start - allow external images // check to see if image is external or internal (check for http) if ( substr($print_catalog_array['image'],0,4) == 'http') //if external image { $imagepath=$print_catalog_array['image']; } else { $imagepath=DIR_IMAGE.$print_catalog_array['image']; } // Mod end Can anyone help on the UltraPics contibution?
muraduk Posted July 19, 2010 Posted July 19, 2010 Ok Success, You can have both local and remote images at the same time. External images are not supported because your server and images location are prefixed to the image name, so if you use Easy Populate to import your items with the url set to something like 'http://remote.server.ip.address/image.name', this is prefixed inside the function tep_image. This can be rectified by editing /catalog/includes/functions/html_output.php Find the following:- //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) { return false; } Add immediately after:- // check to see if image is external or internal (check for http) and modify $src if ( substr($src,strlen(DIR_WS_IMAGES),4) == 'http') { $src = substr($src,(strlen(DIR_WS_IMAGES))); } This will check to see if the first 4 characters of the filename are 'http' if they are it will re-write the variable $src to remove the local server url and images directory, allowing OSCommerce to download the image from the remote server; this will cause additional traffic to the remote server so be sure you have permission to do this. Please note the click to enlarge link on my site has stopped working for all remote images since I made this alteration, I am using the UltraPics addon so I assume it is also looking for a local file, I will try and look into this unless someone else knows why this is? Hi i have completed the above successfully.... my image properties are now showing the correct URL But the image is still not showing... is there anything else i need to do... have a look at the site www.jungle2jungle.co.uk Hope you can help.. Thanks..
Task1 Posted October 17, 2010 Posted October 17, 2010 Hi.... was wondering if anyone can post a working copy of the html_output.php file with the net bits added as i put it in and it is not working My Regards Task1
Task1 Posted October 17, 2010 Posted October 17, 2010 Hi.... was wondering if anyone can post a working copy of the html_output.php file with the net bits added as i put it in and it is not working My Regards Task1 i should of put this on as well !! this is the part you are on about but it looks diffrent //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title=" ' . tep_output_string($alt) . ' "'; } if (tep_not_null($width) && tep_not_null($height)) { $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; } if (tep_not_null($parameters)) $image .= ' ' . $parameters; $image .= '>'; return $image; } Thanks
Task1 Posted October 20, 2010 Posted October 20, 2010 i should of put this on as well !! this is the part you are on about but it looks diffrent //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title=" ' . tep_output_string($alt) . ' "'; } if (tep_not_null($width) && tep_not_null($height)) { $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; } if (tep_not_null($parameters)) $image .= ' ' . $parameters; $image .= '>'; return $image; } Thanks I dont need a reply as i had a programmer do it for meit cost a few $$$ but it works fantastic
xvoyance Posted March 23, 2012 Posted March 23, 2012 i should of put this on as well !! this is the part you are on about but it looks diffrent //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title=" ' . tep_output_string($alt) . ' "'; } if (tep_not_null($width) && tep_not_null($height)) { $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; } if (tep_not_null($parameters)) $image .= ' ' . $parameters; $image .= '>'; return $image; } Thanks This code had something wrong, perhaps logic. I copy and past it into my program, it does not show any image.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.