dragon5 Posted July 3, 2004 Posted July 3, 2004 This portion of code is from a contribution called BigSizeImage. Note the German $vorhanden amongst the English: <?php $vorhanden = file_exists(DIR_WS_IMAGES . "G".$products['products_image']); if($vorhanden){ echo tep_image(DIR_WS_IMAGES . "G".$products['products_image'], $products['products_name']); }else{ echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); }; ?> I am assuming that this is why the contrib does not work? Anyone know the english version of vorhanden? thanks d5
Jack_mcs Posted July 3, 2004 Posted July 3, 2004 I don't speak, or read, German but according to my fried Heir Google, it means exist. The code is just checking for the existence of a file. If it exists then one image is shown, if not, then the other. To see what file it is looking for, place the following right before the code but after the <?php echo 'IMAGE PATH = ' . DIR_WS_IMAGES . "G".$products['products_image']; When you display the page in your browser, you should see it printed out. HTH, Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
burt Posted July 3, 2004 Posted July 3, 2004 $vorhanden is simply a variable. It could just as easily be: $snoopy or $gesundheit or whatever. $vorhanden is nothing to do with why you have a problem. This looks like a small/large image mod. small image == blah.jpg (for exmaple). Script is then loking for Gblah.jpg (G probably signifying "large image") or somesuch.
PVK Posted July 3, 2004 Posted July 3, 2004 vorhanden is the german word for : available [or like the previous post said exist] don't know if it helps though
dragon5 Posted July 3, 2004 Author Posted July 3, 2004 Ok, then why doesn't the d**n thing work? :) Full Script: <?php /* $Id: popup_image.php,v 1.18 2003/06/05 23:26:23 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $navigation->remove_current_page(); $products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'"); $products = tep_db_fetch_array($products_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo $products['products_name']; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <script language="javascript"><!-- var i=0; function resize() { if (navigator.appName == 'Netscape') i=40; if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i); self.focus(); } //--></script> </head> <body onload="resize();"> <?php $vorhanden = file_exists(DIR_WS_IMAGES . "G".$products['products_image']); if($vorhanden){ echo tep_image(DIR_WS_IMAGES . "G".$products['products_image'], $products['products_name']); }else{ echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); }; ?> </body> </html> <?php require('includes/application_bottom.php'); ?> Thanks d5
user99999999 Posted July 3, 2004 Posted July 3, 2004 I think blah.jpg is the products_image uploaded in admin and Gblah.jpg is the thumbnail. So there should be another script that makes the thumbnail, requires gd lib or imagemagik, or else you could make them yourself and upload them.
user99999999 Posted July 3, 2004 Posted July 3, 2004 Also if the G.... files are actually there but show up as a brroken image then download one and open it in notpad and see if its a php error message or if its image data.
dragon5 Posted July 4, 2004 Author Posted July 4, 2004 According to the instructions with the contribution: 'This is a mofication of the popup_image.php file in order to use big images. You have to change this file for the other located in /catalog/ Whith this modificacion that whe do is when click to enlarge, we call the big image that must to be named the same the same but whith a "G"before. If the small image calls "picture.jpg" the big must be called "Gpicture.jpg". Theese image have to upload via ftp to the directory /catalog/images/ Sorry about my english,' Gblah would be the large image and blah would be the thumb??? d5
atomik Posted July 12, 2004 Posted July 12, 2004 According to the instructions with the contribution: 'This is a mofication of the popup_image.php file in order to use big images. You have to change this file for the other located in /catalog/ Whith this modificacion that whe do is when click to enlarge, we call the big image that must to be named the same the same but whith a "G"before. If the small image calls "picture.jpg" the big must be called "Gpicture.jpg". Theese image have to upload via ftp to the directory /catalog/images/ Sorry about my english,' Gblah would be the large image and blah would be the thumb??? d5 Hi d5 :) I've modified a little your script because it didn't work in my case. The reason was because i placed images in subdirectories of catalog/images/ folder so simple adding a G letter before an image name did not work from obvious reasons. Using modified script, you have to name your images according to the following scheme: example_name.jpg - for small image example_name_big.jpg - for big image Another words, you have to add a suffix "_big" to the name of the file. Other comments included in script. <?php // Inserted by AtomikNet, to display bigger images // // To display bigger images, you have to put them in the same directory as a thumbnail // and give it a suffix of "_big" just before a dot preceeding a file extension // pay attention NOT to put any other dots in file name or filepath // only ONE dot preceeding file extension is alowed // get filename to display and replace dot with _big dot (i.e. replace "." with "_big.") $filename_to_display = $products['products_image']; $filename_to_display = str_replace ('.', '_big.', $filename_to_display); // now check file existance $file_available = file_exists(DIR_WS_IMAGES . $filename_to_display); // and display standard or big image when available if($file_available){ echo tep_image(DIR_WS_IMAGES . $filename_to_display, $products['products_name']); // big one }else{ echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); // standard }; ?> Thanx for your advice d5 :) Tom
billwerth Posted August 1, 2004 Posted August 1, 2004 I also tried to use this contribution (BigSizeImage) with no luck. Troubleshooting the problem against a nearly clean install of osCommerce showed that it won't work if there are subdirectories under the catalog images directory. I came up with a similar fix to yours, but it doesn't restrict the file to a single dot, although it uses regular expressions that may not be available in version below 4.2.0. Just replace the code between the <?php and ?> near the end of the file with this code: // Requires at least PHP 4.2.0 $big_image = preg_replace("/(.*)(\..*)/", "$1_big$2", $products['products_image']); $fileExists = file_exists(DIR_WS_IMAGES . $big_image); if ($fileExists) { echo tep_image(DIR_WS_IMAGES . $big_image, $products['products_name']); } else { echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); } BTW, what is the procedure for posting a fix to someone's contribution? Do you just upload the new version at the same location?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.