cmstech Posted April 23, 2004 Posted April 23, 2004 Hello, I have over 1500 items in my store. All were uploaded into the MySQL database directly. I am using 2.2 MS2 Since we have so many items, when we imported, we set the image name to the model number with .jpg at the end. (Example: Model Number is "123" so we set the product image to "123.jpg" However, we don't have all the pictures taken yet, so this results in broken images for about half of the items. I have "images required" set to false, but I am assuming that since the database refers to an image, it still tries to display it. I tried the contribution Here. But that didn't work. Using that code I have: //// // 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; } $img=true; if ($src == "images/"){ $img = false; $src = "images/noimg.jpg"; } // alt is added to the img tag even if it is null to prevent browsers from outputting // the image filename as default $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 ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) { if ($image_size = @getimagesize($src)) { if (empty($width) && tep_not_null($height)) { $ratio = $height / $image_size[1]; $width = $image_size[0] * $ratio; } elseif (tep_not_null($width) && empty($height)) { $ratio = $width / $image_size[0]; $height = $image_size[1] * $ratio; } elseif (empty($width) && empty($height)) { $width = $image_size[0]; $height = $image_size[1]; } } elseif (IMAGE_REQUIRED == 'false') { return false; } } Does anyone have any ideas? Solving this would save me ALOT of time. What I want to happen is it looks for the pic and if the pic doesn't exsist, use a default like "noimage.jpg". Thanks in advance for ANY help.. Jason
Bugs Bonny Posted April 23, 2004 Posted April 23, 2004 I had the same problem, when you make a transparent picture en upload that one the broken picture is not there anymore. Everything else was not working in the shop!!! Good luck
cmstech Posted April 23, 2004 Author Posted April 23, 2004 I saw that listed on other posts, however I am not quite sure how that would work. I have items like this: Item 123 looks for 123.jpg Item 456 looks for 456.jpg Item 789 looks for 789.jpg etc. If I created a transparent pic and uploaded it, wouldn't I have to copy the image for each broken item? Meaning for the example above, I would have to have 3 instances of the transparent pic, one with 123.jpg, and 456.jpg, and 789.jpg? With over 1500 items, I am not sure which ones we have pics for and which ones we don't. Isn't there some sort of code that will tell look for that pic and if it isn't there, point to a set image? I am sure this can be done in the PHP.. Thanks jason
Recommended Posts
Archived
This topic is now archived and is closed to further replies.