galen Posted May 24, 2004 Posted May 24, 2004 This is the support topic for http://www.oscommerce.com/community/contributions,2094 I didn't write this script and i'm helping to provide some support. Galen Quote
Dennisra Posted May 25, 2004 Posted May 25, 2004 Galen: Thank you for taking on this project. I really appreciate your effort. Hopefully many other osCommerce user will also in the future. I am going to install now using your excellant directions and I'll report back here. Thank you again. I am grateful. Quote
Dennisra Posted May 25, 2004 Posted May 25, 2004 Hello Galen: Thanks again for working on this contrubution. I get this error: Parse error: parse error, unexpected T_STRING in includes/configure.php on line 26 This is line 26 of configure.php define('DIR_WS_RSIMAGES' DIR_WS_IMAGES . 'res/'); If I move the line I get the same error put a different line #. I have created the directory res under images and chmod it 777. I also tried changing <U>'res/');</U> to <U>'images/res/');</U> and same error. I would bet this is a simple thing simple that I am overlooking in my haste to get this working but for the moment I am stumped. I'll keep trying but do you see something I am forgetting? Quote
xtend Posted May 25, 2004 Posted May 25, 2004 Try this: define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'res/'); greetings! Quote
Dennisra Posted May 25, 2004 Posted May 25, 2004 xtend: That did it, at least part way. Thank you. We are now making images in the res directory. However thay are not showing up in the browser. Check here: http://www.drabel.com/catalog/index.php?cPath=47 Any thought on the new problem??? Quote
Dennisra Posted May 25, 2004 Posted May 25, 2004 Now I have noticed something else. The images that are being created in the res directory are the same size as the originals. They have been renamed but the same size. Images are still not showing although the img src path appears to be correct. Please see this url for a comparision of the contribution installed and what the page should look like: http://www.drabel.com/magick.html Quote
galen Posted May 25, 2004 Author Posted May 25, 2004 perhaps try turning on images even if there isn't one so you can see the broken image link. Then you should be able to click properties and see what image it is trying to display.. Galen Quote
Dennisra Posted May 26, 2004 Posted May 26, 2004 Hello Galen: The place where you would normally see a broken image is only a tiny dot that I can not get properties from. However, when I view the page source the img src link is: <img src="images/res/1633-82_1_1.jpg" The image is there. But has not been reduced. It is the same size as the original. In addition, it is not showing up on the web page. For those attemping this contribution in configure.php this line should be: define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'res/'); The , was left out of the original. I think we are close to getting this to work. I appreciate your efforts Galen. Suggestions? Dennis Quote
chnkiemnky Posted May 26, 2004 Posted May 26, 2004 Hi guys! Thanks Galen for all your help so far. I installed this contribution per the instructions and now all of my images have disappeared. Even my logo in my header. I reinstalled a fresh install of ms2.2 and tried again and still.. no image at all. Anyone know what I am doing wrong?? Here is my store: http://ragabelle.com/bowtique/ Thanks in advance for any help. I have about 6 sites I need to get this working one. Shanna Quote
Dennisra Posted May 26, 2004 Posted May 26, 2004 Shanna: Looks like the same problem I have. I am sure it is solvable but certainly not by me. Hopefully Galen will check in again shortly. Dennis Quote
chnkiemnky Posted May 26, 2004 Posted May 26, 2004 Hi Dennis! :) I am glad that at least it it doing something. I have tried several resize contributions and have yet to get any them to work. I had one other contribution that did this same thing. And then another that fixed the images in the admin area as well as the catalog area. Unfortunaltely only the admin area worked for me. I only need the catalog area to work. If anyone has some insigt.. Please let me know. I have root access to the server, So I can change anything I need. ;) Shanna Quote
chnkiemnky Posted May 28, 2004 Posted May 28, 2004 I had to put the original html_output back so I could do some work on the site. But, I haven't given up. I am still looking for help on this one. ;) TIA Shanna Quote
Mosaico Posted May 31, 2004 Posted May 31, 2004 I've installed the contribution and I have the same problem that "dennisra", the contribution makes the thumbs but with the same size (or higher) than the original image. I think the trouble is that mogrify.exe it's in the wrong place, and I don't understand this: -install imagemagick and copy mogrify to your safemode path Thank you P.D: Sorry my english Quote
Dennisra Posted May 31, 2004 Posted May 31, 2004 Mosaico: This is what I have tried: exec(DIR_IMAGEMAGICK . "/usr/local/bin/mogrify -geometry " . $width . " " . $filename_small); Of course that hasn't worked for me either. Hopefully when people get home from the Memorial Day weekend we will get a helpful response. Dennis Quote
galen Posted June 1, 2004 Author Posted June 1, 2004 Hi Guys, Sorry I haven't been around to reply, but oscommerce didn't send me a message saying there have been forum replys.. :( Now, i've been having a look at mogify and I think you should have a read of this URL http://ftp.fifi.org/ImageMagick/README.txt Probably notice the bit about support for JPEG and other modules, if you don' thave support for these modules them mogify won't be able to process them. What I suggest doing is that you get a JPG which you know the size of and try manually running mogrify. mogrify man page - http://amath.colorado.edu/computing/softwa...n/mogrify.html) EG. To scale an image of a cockatoo to exactly 640 pixels in width and 480 pixels in height, use: mogrify -resize 640x480! cockatoo.jpg Try this, and if you get this kind of thing working you can then work on the webpage. I'm still having a play around myself, will get bak when I know more. Regards Galen Quote
galen Posted June 1, 2004 Author Posted June 1, 2004 I've had a little more of a look into the programming and this is what the function does. It copies the image from its original location and places it in the res directory, with an updated filename of the dimensions. From there it runs the mogrify command. From what I see, the mogrify command does not have the librarys to convert over the image so it actaully does nothing leaving you with the same image. When mogrify does work it overwrite the image with the correct sized image. I did a few trials with .tiff, .png, .jpg and the only one that worked as it should was .png. All the others came up this with error mogrify: no decode delegate for this image format This means that there is no library so you gotta get them and install them. A comprehensive list can be found at this address. http://ftp.fifi.org/ImageMagick/README.txt Hope this helps Galen Quote
galen Posted June 1, 2004 Author Posted June 1, 2004 (edited) Well, after a little more playing around I got it all working. These are the steps I went thru. downloaded the jpg librarys and gif librarys (these are the only 2 formats I use) recompiled these with imagemagick added this fine to the start of the tep_image function define('DIR_IMAGEMAGICK','/usr/local/bin/'); loaded up some pages and an image of 1974x857 was resized to 100x43, so the picture in the product description was nice and small, and when you clicked on it you got a friggen huge image :D This contrib kinda makes thumbnails on the run, and will keep your dimensions. Note: you can use convert/mogrify etc to change pictures to your liking add in text/watermarks. Probably the biggest problem is getting the librarys for it. All i can say is test it manually before implemting it in the webpage. Regards Galen *Useful NOTE ;) : Delete all images from the res directory to get them to start creating again. Once created they will not re-create or modify the ones already in there. Edited June 1, 2004 by galen Quote
galen Posted June 1, 2004 Author Posted June 1, 2004 Sorry for the many many posts.. but it won't let me edit my previous posts.. but a bit of reading for you guys ;) my oscommerce webpage currently has it running, www.advisns.com.au If you view a product you will see the re-sized image but if you click on the show larger image it will show the original image. To test this on my web page view a product, right click on the image and click view image. You should then see an image which is resized(probably 100x80) then click on the image and you should see a much larger image. Generally they are about 1/4 of the size of the full size image. The people who I currently host with also had imagemagick already installed so it was an easy thing for me to implement (took a while longer when testing it on my home linux machine as you can see from the posts above) If the place you host with does not have imagemagick installed perhaps try to ask them nicely or even try uploading it yourself but in doing this you will need to upload a couple of things, a couple which I know of are mogrify, libMagick.so.6(the library it calls), also any librarys used to resize.. these may also be compiled into the libMagick.so.6... Good Luck Galen Quote
galen Posted June 1, 2004 Author Posted June 1, 2004 I've updated the thumbnails.txt with lots more information. Have a look http://www.oscommerce.com/community/contributions,2094 Galen Quote
chnkiemnky Posted June 2, 2004 Posted June 2, 2004 Hi Galen, Thanks for all of your hard work!! I have tried this contribution again in hopes that it woud work. Unfortunately it's just not working. :( When I update the html_output.php file, all of my images/icons disappear. It does not matter if they are gifs, jpgs, etc. Can someone post a clean html_output.php with these mods included so i can compare. Perhaps I am missing something. Or if anyone else has any suggestions, my ears are open. ;) I left the site as is for now.. here you can see.. no images. Ragabelle Bowtique Thanks in advance for any help. Shanna Quote
galen Posted June 2, 2004 Author Posted June 2, 2004 Its possible you have defined DIR_WS_RSIMAGES incorrectly. It may be trying to look for images but its looking in the wrong location. If you don't already turn on disaply images even if there aren't any, so you can see broken links and where/if they are linked anywhere. If Imagemagick isn't working you should still see the copied images, just not resized. I'd b leaving towards something is incorrectly setup in your config, not in the function below, as its pretty much static. from configure.php define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'resized/'); As for my html_output.php file, here is the snippet from the tep_image function from the catalog/includes/functions/html_output.php function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $res = 1, $addattribs = 1){ define('DIR_IMAGEMAGICK','/usr/local/bin/'); 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, $oitype) = 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]; if (!file_exists($filename_small)) { copy($src, $filename_small); exec(DIR_IMAGEMAGICK . "mogrify -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 $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 ($addattribs && 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; } Quote
chnkiemnky Posted June 2, 2004 Posted June 2, 2004 I have not changed anything in my configure.php file aside from adding these 2 lines: define('DIR_WS_RSIMAGES', DIR_WS_IMAGES . 'res/'); define('DIR_IMAGEMAGICK', '/usr/bin/'); When I put the old default html_output.php file back in place, my images show up like so: Ragabelle Bowtique my server meets all of the requirements AFAIK: phpinfo The thing is I have 6 diff sites on my server using oscomm and this does not work on any of them. :( Shanna Quote
chnkiemnky Posted June 2, 2004 Posted June 2, 2004 Ugh... sorry, I can't edit either. I checked my res/ dir and no images are being written to there either. Shanna Quote
galen Posted June 3, 2004 Author Posted June 3, 2004 Have you got the correct permission on the res directory? (chmod 777) As the script just copies the picture to the res directory then changes it from there. Like I was saying above if the pictures are copied there but they haven't been resized then everything is working except mogrify. Something which I do quite often is echo varables thoughout the function (eg echo $src) to see how far or were it gets.. or even if it even uses the function. Sometimes I create an error on purpose to see if it gets read.. as sometimes echoing doesn't work(if it redirects at the end of the function.. generally called via tep_redirect) Regards Galen Quote
chnkiemnky Posted June 3, 2004 Posted June 3, 2004 Have you got the correct permission on the res directory? (chmod 777) yep. Perms are fine. As the script just copies the picture to the res directory then changes it from there. Like I was saying above if the pictures are copied there but they haven't been resized then everything is working except mogrify. I wish I could get the pics to at least copy there... then at least I would know it was mogrify. It seems weird thought that even my graphic in my header disappears... as well as icons, etc. They all vanish.. not even a red X. Something which I do quite often is echo varables thoughout the function (eg echo $src) to see how far or were it gets.. or even if it even uses the function. Sometimes I create an error on purpose to see if it gets read.. as sometimes echoing doesn't work(if it redirects at the end of the function.. generally called via tep_redirect) And this is where I am getting in over my head. LOL. I am not sure where/how to insert an echo statement. Any help would be very grateful. Thanks. Shanna Quote
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.
Note: Your post will require moderator approval before it will be visible.