mistmov Posted October 21, 2004 Share Posted October 21, 2004 I am trying to figure out how I can overlay an image border (an image which is transparent in the middle) over to the smaller, thumbnail image (product image) using Imagemack. I have sort of figured out how to get that using two of the same image file formats (2 gif images or 2 jpg images... can you overlay different image formats somehow?). What I can't figure out is, the product thumbnail images that I want to have the borders for are all different sizes. Does anyone know of a way where I could figure out the size of the product thumbnail image so the border image can match it's size? Thanks! Quote Link to comment Share on other sites More sharing options...
[email protected] Posted October 26, 2004 Share Posted October 26, 2004 (edited) Hi Didier, I would re-check steps 2 & 3 from the thumbnails.txt Also this is the line where it changes the image sizes exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $width . " " . $filename_small); i would not mess around until you have the core contrib working <{POST_SNAPBACK}> Hello Galen, I am confused for two things : 1) I did used an older version of OSCommerce and it was not compatible. 2) When I found solution, I started working hard on my site to get all things working ... and did not check anymore the forum. When I found solution I have then reinstall latest version and I could get it working ... but result was not so good... images were resized but definition was very bad. I then changed the sting : exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $width . " " . $filename_small); with exec("mogrify -geometry " . $width . " " . $filename_small); and then I found that new items had resizing with perfect definition.... but older resized images where still not good... Then I removed all images from directory images/res and then ... tada ... all resized images are perfect since then. Anybody can see result on www.TECnnis.be (in french only ). So Gallen, :thumbsup: I thank you very much for you help and apologies to have messed with this forum. Didier Edited October 26, 2004 by [email protected] Quote Link to comment Share on other sites More sharing options...
Guest Posted November 13, 2004 Share Posted November 13, 2004 Hello, im just installed this contribution, i read this trhead and i made all the configuration well, but the images are still the same size, y run directly from shell the mogrify command and get and jpeg pic resized, but in oscommerce are the same size, in the res directory all the images got the name assigned from the new funtion, and i dont know what could be the problem this is the url http://www.solucionesintranet.com/store/catalog/index.php can anybody help me?? TIA Edgar Quote Link to comment Share on other sites More sharing options...
mistmov Posted November 13, 2004 Share Posted November 13, 2004 do you have the thumbnail image sizes set correctly in your admin area? Quote Link to comment Share on other sites More sharing options...
galen Posted November 14, 2004 Author Share Posted November 14, 2004 is mogrify pointing to the correct location? when you define it Quote Link to comment Share on other sites More sharing options...
Guest Posted November 15, 2004 Share Posted November 15, 2004 is mogrify pointing to the correct location? when you define it <{POST_SNAPBACK}> in the admin section appears the same size, in normal size, if you can see in the res dir, the pics got the correct names the mogrify program is in /usr/bin and the configuration file os oscommerce is defined as define('DIR_IMAGEMAGICK','/usr/bin/'); define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'res/'); so i think mogrify is working, but dont know why is making the new pics as the original size, can you help me? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 15, 2004 Share Posted November 15, 2004 i saw another thing, im checking the resize from command line and got this when run mogrify -resize 120x120 test.jpg got no error and the result image is resized but when run from another user like webuser (as i image that oscommerce will run mogrify as apache) i got this error mogrify: no decode delegate for this image format `test.jpg'. so i think the problem is, when running mogrify from the web got this error and left the images as their original size, what can i do to resolve this problem?? TIA EDGAR Quote Link to comment Share on other sites More sharing options...
Guest Posted November 15, 2004 Share Posted November 15, 2004 i fix the last post problem, it was an error in the path of the library, and now i decides to test from command line with the apache user using the line /usr/bin/mogrify +profile "*" -filter Lanczos -quality 75 -geometry 100 "test.jpg" and the resized mades correct, i remove all files in the res directory and reload the page, im sure that the mogrify exec is running, and when i check the res directory thres a lot of images, but all the images are the same size as the original, i dont know why when i run from command line its ok but when run from the htlm page gets the same size, please help me! TIA Edgar Quote Link to comment Share on other sites More sharing options...
galen Posted November 15, 2004 Author Share Posted November 15, 2004 Just a little info on how the re-size works.. first it checks the size of the original image, and then works out what the re-sized image will be. then it copys the original image to the res directory with the resized dimensions attached to the end of the file "picture_55_24.jpg" From there it runs mogrify on the filename and resizes it. If its not resizing then mogrify is not working correctly. So from the looks of what you are saying you are still having problems with mogrify. Just a few things to check are that everything in the configure.php is defined correctly and the path to mogrify is correct... perhaps even output the line you are going exec before you exec it(echo it) Also if you are still having troubles have a look at the php functions exec and passthru to see if you can get any output from the mogrify within the webpage. (you will probably have to place a "die;" statment in your code to stop the page being redirected and reloaded possibly loosing any error message. Regards Galen Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2004 Share Posted November 16, 2004 Hello, i fix the problem thnx for the last post it help me a lot, after a lots of test, the problem was the safe_mode ond php.ini was enabled, for security reason i decide to left the configuration as that, so i just made a vhost.conf file in the oscommerce directory for include with de httpd.conf file, like this added a vhost.conf file with: == <Directory "/home/httpd/vhosts/server.mydomain.net/httpdocs"> php_admin_flag safe_mode off php_admin_value open_basedir none </Directory> == and restart apache im using php 4.3.9 so the php_admin_value open_basedir none is needed to properly disable safe_mode, the thumbs are now generating well and the contrib is working perfect, thnx for this!!! Edgar Quote Link to comment Share on other sites More sharing options...
osjunkie Posted December 1, 2004 Share Posted December 1, 2004 OK, I read every post on this support form and I have determined I have a unique problem not posted. I have this working great on the catalog size and it worked wonders. But on the Admin side when I input a new product or edit the product when I preview I get MISSING IMAGE warnings. After I submit and can click on the product again in the admin to see a preview and the images are there. What did I do wrong or have wrong? I have WYSIWYG, FEATURE SETS installed. It seams not to recognize the new thumbnail....probably because it has the original picture file location from WYIWYG that was pulled from the database during editing and no information yet when first uploaded. It would be nice to have this resolved so we don't have to go back and open the preview each time. Thanks for any solutions. Quote Link to comment Share on other sites More sharing options...
lovetolearn Posted December 21, 2004 Share Posted December 21, 2004 I can't but think that the problems people are having here are related to a problem that I saw with imagemagick and Internet Explorer on one of my sites. Apparently, Internet Explorer has a bug that won't allow jpegs with XML meta data. This article lead me to the Solution Quote Link to comment Share on other sites More sharing options...
eleganta Posted February 1, 2005 Share Posted February 1, 2005 I have been using oscommerce for about a week and it is a great product. Store at http://www.elegantannouncements.com However, my problem is that I have different sized announcements which really needs the auto resize image on it but my ISP won't install imagemagik on it. What are my other options? Quote Link to comment Share on other sites More sharing options...
jcisar Posted February 12, 2005 Share Posted February 12, 2005 (edited) Hello, Thanks Galen. Your contribution is what my store needed, so I can?t wait to get it correctly installed. I opened a bumper sticker using oscommece which can be Viewed Here. My Problem: I recently installed Galen?s image resize contribution (version. resimage_1_2_3_4_5_1) Now I am receiving the following errors in my Admin panel in the inventory section under catalog /category/products. None of my inventory pictures show up right, but instead I get the broken image where my pic should be. Although my inventory pictures are showing in my store catalog, they aren?t resizing at all. I know the problem is in how I installed it, but I am not too sure as to where the problem is within the specified file. Here are the error messages I'm getting in my admin panel under catalog/categories/products: Warning: copy(DIR_FS_CATALOG_IMAGESres/got love_162_42.jpg): failed to open stream: No such file or directory in /home/censored/public_html/catalog/admin/includes/functions/html_output.php on line 93 Warning: exec() has been disabled for security reasons in /home/censored/public_html/catalog/admin/includes/functions/html_output.php on line 94 What are these error message trying to tell me? What should I do next? The lines 93 and 94 cited in the error message for /admin/includes/functions/html_output.php contain the following: copy($src, $filename_small); exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . Thanks Galen. jcisar Edited February 12, 2005 by jcisar Quote Link to comment Share on other sites More sharing options...
Guest Posted February 17, 2005 Share Posted February 17, 2005 Ho to all, I have a fresh install of 2.2ms2 version and tryed this script but when I try the catalog main, it says: Parse error: parse error in /path_to_my_site/catalog/includes/functions/html_output.php on line 173 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/webs/store.mormon-isimo.com/catalog/includes/functions/html_output.php:173) in /path_to_my_site/catalog/includes/functions/sessions.php on line 67 :'( Then the shop logo, and the links at the right, and then: Fatal error: Call to undefined function: tep_draw_separator() in /path_to_my_site/catalog/includes/classes/boxes.php on line 117 :blink: I replaced as instructed the function: // 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; } for: //// // The HTML image wrapper function // Stark erweitert zur Erzeugung und Anzeige von Thumbnails /// function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $res = 1, $addattribs = 1) { if ((empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') || !is_file($src)) { return false; } if ( !strstr($width, '%') && $res) { $width = round($width); $height = round($height); preg_match("/.*\/(.*)\.(\w*)$/", $src, $fname); list($oiwidth, $oiheight, $type, $dimstring) = getimagesize($src); if (($width || $height) && ($height < $oiheight || $width < $oiwidth)) { if (!$height) $height = 1; if (!$width) $width = 1; $k = max($oiheight / $height, $oiwidth / $width); //use smallest size $width = round($oiwidth / $k); $height = round($oiheight / $k); // createthumb($filename, $width, $height, "test.jpg"); $filename_small = DIR_WS_RSIMAGES . $fname[1] . '_' . $width . '_' . $height . '.' . $fname[2]; // Neue Datei nur bauen, wenn kein Thumb vorhanden oder Original neu if (!file_exists($filename_small) || filemtime($src) > filemtime($filename_small)) { copy($src, $filename_small); exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""); } $src = $filename_small; } } // alt is added to the img tag even if it is null to prevent browsers from outputting // the image filename as default if (file_exists($filename_small)) // Bildgroessen setzen, wenn Thumb existiert { list($siwidth, $siheight, $type, $dimstring) = getimagesize($filename_small); } $image = '<img border="0" alt="' . tep_output_string($alt) . '" '; if (tep_not_null($alt)) { $image .= 'title="' . tep_output_string($alt) . '" '; } $image .= $dimstring . ' '; // setzt die Breite und Hoehe des anzuzeigenden Bildes fuer den Browser if (tep_not_null($parameters)) $image .= $parameters; // Falls PNG-Bild ankommt, wollen wir dem IE auch ne Chance lassen $msie='/msie\s(5\.[5-9]|[6-9]\.[0-9]*).*(win)/i'; if(($type == 3) && preg_match($msie,$_SERVER['HTTP_USER_AGENT']) && !preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT'])) { $image .= ' src="' . DIR_WS_IMAGES . 'blank.gif" align=BOTTOM style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . tep_output_string($src) . '\', sizingMethod=\'image\');" >'; } else { $image .= ' src="' . tep_output_string($src) . '">'; } return $image; } and if I put the file as it used to be, there's no error. Please help !! :blush: JC Gomar Quote Link to comment Share on other sites More sharing options...
oldworldcharms Posted March 8, 2005 Share Posted March 8, 2005 Did anyone ever get this to work? I am wondering if I am on the right track. right now I have one larger image and extra images I have to make 2 images per image. One for the larger popup window image and one for the thumbnail. I am hoping to find a contribution where I could upload one image (the popup image) and it is resampled down for the thumbnail image. Thanks Elizabeth Quote Link to comment Share on other sites More sharing options...
m_c_p_19 Posted March 21, 2005 Share Posted March 21, 2005 Seems alot people are having trouble with mogrify. I fixed my problem just by changing the following line exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""); to exec("mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""); Mine works fine now before it just copied pictures, tried everything to fix, loged into my ssh and typed mogrify it worked presumed website would be the same and it was. Help this will help others, as many posts has help me. Cheers Quote Link to comment Share on other sites More sharing options...
osjunkie Posted April 2, 2005 Share Posted April 2, 2005 I just figured out this contribution is killing the seperator function and keeping the 1 x 1 pixel that size and not allowing the 100% width variable to function to draw a line or a space. function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') { return tep_image(DIR_WS_IMAGES . $image, '', $width, $height); } Any ideas on how to fix this? Probably most people haven't even noticed this, but in the shopping cart pages your little lines connecting the process steps is missing cause of this. Also other contributions that call on this are missing their lines. Please post a fix! Thanks, Brad Quote Link to comment Share on other sites More sharing options...
osjunkie Posted April 2, 2005 Share Posted April 2, 2005 I just figured out this contribution is killing the seperator function and keeping the 1 x 1 pixel that size and not allowing the 100% width variable to function to draw a line or a space. function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') { return tep_image(DIR_WS_IMAGES . $image, '', $width, $height); } Any ideas on how to fix this? Probably most people haven't even noticed this, but in the shopping cart pages your little lines connecting the process steps is missing cause of this. Also other contributions that call on this are missing their lines. Please post a fix! Thanks, Brad <{POST_SNAPBACK}> Ok, I don't know if this is the best way to go about this but I used the old code replaced by the Image Resize install to make seperators only. Put this before tep_image // The HTML tep_image_seperator wrapper function function tep_image_seperator($src, $alt = '', $width = '', $height = '', $parameters = '') { if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) { return false; } // 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; } } 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; } //// // Output a separator either through whitespace, or with an image function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') { return tep_image_seperator(DIR_WS_IMAGES . $image, '', $width, $height); } If you can refine this even more to a simpler state please go ahead and repost it. Thanks, Brad Quote Link to comment Share on other sites More sharing options...
adcprod Posted May 18, 2005 Share Posted May 18, 2005 (edited) /usr/bin and the configuration file os oscommerce is defined as define('DIR_IMAGEMAGICK','/usr/bin/'); define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'res/'); so i think mogrify is working, but dont know why is making the new pics as the original size, I cannot emphasize how important the above part is. WHATEVER YOU DO, DON'T MISPELL IMAGEMAGICK. :blink: Somewhere in the instructions, it calls it "IMAGEMAGIC" (without the "K"). As far as variables are concerned, that will definetly not work. Here is something else you can try to make sure your command line comes out correctly. Add the line with echo to the the html_output.php functions in both admin and the regular osCommerce directories: if (!file_exists($filename_small) || filemtime($src) > filemtime($filename_small)) { copy($src, $filename_small); exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""); //adding the following line for testing mogrify command echo DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""; :thumbsup: Edited May 18, 2005 by adcprod Quote Link to comment Share on other sites More sharing options...
adcprod Posted May 18, 2005 Share Posted May 18, 2005 Jus to clarify, just add the line with the echo, the other stuff should already be there. if (!file_exists($filename_small) || filemtime($src) > filemtime($filename_small)) { copy($src, $filename_small); exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""); //adding the following line for testing mogrify command echo DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\""; :-" <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Guest Posted May 23, 2005 Share Posted May 23, 2005 The last post on my problem was April 2, 2005. I hope this thread isnt dead and there are some who've conquered my problem. The contrib works good aside from two problems. When Adding a new product or editing an existing one, when you hit the preview before saving changes, the image is gone and the message "IMAGE DOES NOT EXIST" is in it's place. I believe I've traced it down to /admin/includes/functions/general.php (as far as the function that is sensing that the "image does not exist"). However, saving the changes does indeed add the image to the database, and it does show up when you first put focus on a product without hitting the "edit" button, and of course it shows up for the customers when viewing the catalog. In general.php, this function is sensing that the image does not exist. function tep_info_image($image, $alt, $width = '', $height = '', $params='') { if (tep_not_null($image) && (file_exists(DIR_FS_CATALOG_IMAGES . $image)) ) { $image = tep_image($image, $alt, $width, $height, $params,'1'); } else { $image = TEXT_IMAGE_NONEXISTENT; } return $image; } I changed the IF statement both ways and determined that the && (file_exists) part is where it is getting lost. It does not find $image It knows there is an image that has been selected, but it does not find the image in the directory because it is looking for it in /catalog/images/, where our images are in subdirectories. Not sure why the function was written to be so limited. The rest of the system knows the path and doesnt lock it down to one place. (using the MaxiDVD htmlarea insert file/file manager). The rest of the system is finding it and adding it to the product database despite the error. The thumnails via ImageMagick are working too... When adding or editing a product, it shows the file path to the images but when savng changes, it says it does not exist. I've tried to rewrite the function to use the specified path on the editing page for a product, but it in turn breaks something else. Anyone got a lead on this? Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
sCHL Posted May 23, 2005 Share Posted May 23, 2005 hi guys, nice contrib. works very well for me, but I get warnings: Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/html_output.php:458) in /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/general.php on line 1174 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/html_output.php:458) in /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/sessions.php on line 67 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/html_output.php:458) in /srv/www/htdocs/web2/html/vinovera_shop/includes/functions/sessions.php on line 67 Could someone tell me the reason for this? thanks... sCHL Quote Link to comment Share on other sites More sharing options...
sCHL Posted May 23, 2005 Share Posted May 23, 2005 oh I got it. there where some hidden characters from moving a windows copy and paste to the linux system. now it works very well. have a look (german only) http://shop.vinovera.biz Quote Link to comment Share on other sites More sharing options...
christiansees Posted May 24, 2005 Share Posted May 24, 2005 Hello, I am trying to get this contribution working and I am wondering about one of the instructions. STEP 5 - ReminderDon't forget in both admin and catalog have different functions. Did you mean to say Don't forget to update the configure.php in both catalog/admin/includes/ and catalog/includes/ because they have different functions and both need to be updated. The way it is written is confusing I am not certain of the instuction it could be interpreted to mean that you need two copies of the res/ folder one in catalog/images and one in admin thanks Quote On your last day only you will have to approve or disaprove of how your life has been. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.