tomjmul Posted November 20, 2005 Share Posted November 20, 2005 This is the support thread for the 'Image Magic' contribution. Image Magic is a powerful new contribution for OSCommerce designed to greatly improve the way your images are displayed. At the core of its functionality is the ability to produce smoothly rendered thumbnail (smaller) versions of your store's product images. In addition, it also contains a very comprehensive toolbox of 'on-the-fly' image processing functions to both improve your images and also, if you wish, protect them from theft and unauthorized use by your competitors, ebayers and the like. If you are having difficulties installing or using this contribution, your first port of call should be the readme file contained within the package or available online in its most recent form: here Next, you should make sure you have the most up-to-date version of the contribution. And lastly, read this thread to see if someone else has solved the issue. If you are still having problems, then feel free to post here. Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
aarondwyer Posted November 21, 2005 Share Posted November 21, 2005 Well done Tom. Just going through it now and integrating it. Issue with the readme.html in the install with html_output.php, the code is missing a ';' on the $image_size line. Should be this. if (strtolower(getcwd())."/" != strtolower(DIR_FS_CATALOG)) { $image_size = @getimagesize("../..".$src); $src=str_replace(DIR_WS_CATALOG_IMAGES,DIR_WS_IMAGES,$src); } Thanks Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
aarondwyer Posted November 21, 2005 Share Posted November 21, 2005 Ok I'll be first cab off the rank and raise my hand to be dolt of the day. Is anyone else unable to get their images to show.? My product images <img src="blah"> tags are completely missing in the final html, hence no images are showing. The other images (non-product) are all showing up ok. I think this could be related to the shop / non shop image selection option (which is a good option to have). I'm still investigating. Anyone have any ideas for me. Thanks Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
aarondwyer Posted November 21, 2005 Share Posted November 21, 2005 After toggling options for the last half hour, I've worked out that you have to have set in the Images configuration for Image Required = true This allows the images to be shown, and Image Magic is now doing it's thing. I don't really want to have this set, since there are several instances of where I don't have an image, and I'd rather not see a failed image holder. Any ideas? Thanks Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
tomjmul Posted November 21, 2005 Author Share Posted November 21, 2005 Hi Aaron, Thanks for your help. I have fixed the readme. Regards the images required setting, I have switched mine off and it is still working fine, this is going to take a little more tracking down. Following the logic of the tep_image() finction, the only time the image required setting comes in to the equation, is when image magic cannot open the file asked for to check its dimensions (should be an indicator of a missing image file). In this case, it checks IMAGE_REQUIRED and if off, returns nothing (as it should). In your case, it would appear that it can't open any of your images and the paths are somehow wrong. So here is where I'm confused. You say when you switch this on image magic works. Are you sure? Right click one of your images and see does the 'imagemagic.php' script show up in its url. Tom Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
tomjmul Posted November 21, 2005 Author Share Posted November 21, 2005 Aaron, I have now taken out the admin side of this script as there is no need for it in my honest opinion and I can see it will cause a world of trouble (starting with that damn missing semi-colon :) ). The problem is the osC split admin/store way of doing things which I think everyone agrees is a complete nuisance and is to change in ms3. The way I detect whether the script is running in admin and then alter the path was a hack and I never liked it. The other solution would be to go messing with configuration files and such, but I don't see the point. For your version: 1. Restore admin/includes/html_output.php to original. 2. In catalog/includes/html_output.php Change: // If running in Admin adjust the pathname if (strtolower(getcwd())."/" != strtolower(DIR_FS_CATALOG)) { $image_size = @getimagesize("../..".$src); $src=str_replace(DIR_WS_CATALOG_IMAGES,DIR_WS_IMAGES,$src); } else { $image_size = @getimagesize($src); } To: $image_size = @getimagesize($src); This should make everything work with the images required set false. Let me know how you get on. Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
aarondwyer Posted November 21, 2005 Share Posted November 21, 2005 You were correct. It wasn't using ImageMagic before at all. The fix you just mentioned now works like a treat, and the ImageMagic is now actually being used. I can now run with Image Required = false. Thank you. I'm one of the ones from On the Fly that could *never* get server caching to work on windows. It didn't bother me before because I develop on windows and host with linux and it worked on linux. Now I have a task to get it onto a host running windows and am still not able to server cache. Does Image Magic store in an 'thumbnails' sub directory for each image directory or in 1 /images/thumbnails folder? I wasn't sure what the readme was referring to. I have several subdirectories since I've categorised my image directory. My windows system is not writing the thumbnails to the drive at all. At least ImageMagic doesn't die badly when you have server cache turned on unlike On the Fly. Thanks Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
tomjmul Posted November 21, 2005 Author Share Posted November 21, 2005 (edited) Aaron, The way caching works is as follows: Lets say you have a categorized images directory /images/cat1 /images/cat2 images/cat3...etc Now if you have your cache path set to /thumbnails, as the script starts getting used it will start shadowing your image directory under the thumbnails one. So the first time it is asked to produce a thumbnail from an image contained in /images/cat1 it will create a folder thumbnails/images/cat1 and cache the thumb there. This will eventually result in a complete shadow of all of the directories in your images folder within the cache one. Regards windows, I will be installing a store on a windows machine within the next week or so. If I come across any major differences I will create a seperate windows version, otherwise I will tweak. I would have thought that it might have managed as it, but there you are. What happens with caching turned on on windows? Tom Edited November 21, 2005 by tomjmul Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
mcbsolutions Posted November 21, 2005 Share Posted November 21, 2005 hi, thanks for the contribution. This looks great! I'm not very familiar with Image Magic so bear with me on my newbie question. I'm working on a site that has product images that are not all the same width and height (although close). Will I have to make them all have at least one dimension the same (height or width) for my images to display with the correct proportions? Or is there a setting in this contribution that will assist with this? Thanks! Steve Quote Link to comment Share on other sites More sharing options...
tomjmul Posted November 22, 2005 Author Share Posted November 22, 2005 (edited) I'm working on a site that has product images that are not all the same width and height (although close). Will I have to make them all have at least one dimension the same (height or width) for my images to display with the correct proportions? Or is there a setting in this contribution that will assist with this? Yes, you just need to set a maximum width OR height (but generally not both). When i/m is passed a width it will work out the height (and vice versa) itself so as to keep the image always in the correct proportions. If one or more of your images are actually smaller than the dimensions of the thumbnail asked for, you have the 3 options. First, you can set i/m to scale it up. Second, you can have it just display at its native width and height - I.E Over-ride the thumbnail size. And lastly the thumbnail can be produced at the size required, with the source displayed at its size, centered on a white background The basic idea of i/m is to ensure that your thumbnails are always uniform and in proportion Edited November 22, 2005 by tomjmul Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
azer Posted November 22, 2005 Share Posted November 22, 2005 your work seems really so perfectionistic good features .. do you think taht you ll handle multiple image for a products liek mopics or other good contrib ? best regards Quote MS2 Link to comment Share on other sites More sharing options...
aarondwyer Posted November 22, 2005 Share Posted November 22, 2005 Hopefully someone else that runs Windows can confirm. But the server side caching isn't creating directories or of course the thumbnails. Time to break out the debug strings to find out what is going on. Thanks Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
tomjmul Posted November 22, 2005 Author Share Posted November 22, 2005 your work seems really so perfectionistic good features .. do you think taht you ll handle multiple image for a products liek mopics or other good contrib ?best regards Thanks Azer...I did try my best Regards the extra images, it would be very easy to make this contribution work in conjunction rather than instead of these contribs. I may code this into a future version. I did include functionality for an extra sized product information image - The one on the product details page. I did this because I could swing it so that no other files would need modded as this image is only shown on one page, which I could detect. Aaron, to save you a bit of poking, stick a few of those echos around the make_dirs() call in modify_tn_path() Tell me, are you getting the cache creation error message in your images with caching switched on? Anyone else tried caching on windows? Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
Guest Posted November 22, 2005 Share Posted November 22, 2005 I get this error. The only other contrib I have installed is the SPPC 4.11 Parse error: parse error, unexpected '}' in /home2/sacredc/public_html/test/includes/functions/html_output.php on line 228 If I remove the } I then get an error in the header at line 87 < Any ideas would be greatly appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
2oldnslow Posted November 22, 2005 Share Posted November 22, 2005 Install file: Step #4 - Add files Copy the files contained in the zip archive to their respective directories on your server - Easy eh? Hello, I extracted the files and have empty folders at these locations: admin/includes/imagemagic/fonts and watermarks. Is this correct? Quote 2oldNslow I am no expert, I am only trying to help. Always, always back up.Use several browsers like IE, Opera, Firefox and Netscape to view your work.. The free tools work great to do osCommerce changes, PHP Designer 05/06, NoteTab Lite, SciTE, PSPad, XAMPP, Filezilla, 1st Page, osCommerce is #1! Link to comment Share on other sites More sharing options...
will32 Posted November 22, 2005 Share Posted November 22, 2005 Hi, I have installed the new version of this comtribution, but the image magic in admin does not seem to work@ eg i have added the 3d frame and nothing happens also the images seem to be the same as before. pls help thanks Quote Link to comment Share on other sites More sharing options...
tomjmul Posted November 22, 2005 Author Share Posted November 22, 2005 Parse error: parse error, unexpected '}' in /home2/sacredc/public_html/test/includes/functions/html_output.php on line 228 You might have installed it wrong, restore your backups and try again. I extracted the files and have empty folders at these locations: I have removed the admin functionality. Download the latest version on the contribs section of oscommerce. I have installed the new version of this comtribution, but the image magic in admin does not seem to work@ eg i have added the 3d frame and nothing happens also the images seem to be the same as before. pls help To see if im is working properly, right click the image, select properties and check to see if imagemagic.php is in the url Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
aarondwyer Posted November 22, 2005 Share Posted November 22, 2005 (edited) Lots of echo's and 1/2 hour later I have solved the mysterious Windows issues. You must use the full path. DIR_FS_CATALOG. Adjusted to remove the extra slashes. I can't see why full path wouldn't work under unix as well. We'll soon see. Tom maybe you can make this code better and work something into your contrib. in file /catalog/imagemagic.php in function modify_tn_path($file, $check_cache) //create the directory tree if not already there $create_path=dirname($tn_path. $file); //added this line for windows $create_path = substr(DIR_FS_CATALOG,0,strlen(DIR_FS_CATALOG)-1) . $create_path; and // return $tn_path. $file; //comment the above line, added this line for windows return substr(DIR_FS_CATALOG,0,strlen(DIR_FS_CATALOG)-1) . $tn_path . $file; Thanks Aaron Edited November 22, 2005 by aarondwyer Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
will32 Posted November 22, 2005 Share Posted November 22, 2005 You might have installed it wrong, restore your backups and try again.I have removed the admin functionality. Download the latest version on the contribs section of oscommerce. To see if im is working properly, right click the image, select properties and check to see if imagemagic.php is in the url Hi, Thanks for getting back. Ok i have right clicked on the image properties and imagemagic.php is not in the url. my properties show http://domani name/store/images/bodyring.JPG. Any help would be great. I followed the install instructions to the t. Which was posted on 21st November 05. Thanks Quote Link to comment Share on other sites More sharing options...
timinark Posted November 22, 2005 Share Posted November 22, 2005 Tom, I have installed, but not producing images. Image info does point imagemagic.php. I am running Windows server. Tim Quote Link to comment Share on other sites More sharing options...
Guest Posted November 23, 2005 Share Posted November 23, 2005 Ok have it installed properly. The bevel works but the text watermark and the image watermark do not seem to work. It breaks the images no matter if they are .gif or .jpg. Im on a Unix server. And the imagemagic.php is showing in picture link properties. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
aarondwyer Posted November 23, 2005 Share Posted November 23, 2005 Tom, I have installed, but not producing images. Image info does point imagemagic.php. I am running Windows server. Tim Hi Tim You should read the posts above, they will probably answer your question. Check image setup that you don't have both width and heights set. Also see my above posts regarding windows. Try to turn caching off first. Aaron Quote Aaron Dwyer Link to comment Share on other sites More sharing options...
compwhizmm90 Posted November 23, 2005 Share Posted November 23, 2005 (edited) I think I installed this succesfully. But now all of my images show up really big. I adjusted the image sizes in the admin section but it did not work. Also, is there supposed to be a special admin menu for this? I don't see it in my config list. The "Product Information Image Width" option is there but I don't see another seperate menu. Also my images do not point to imagemagic.php. I would like to use this because all of the features but I can't get it to work. Edited November 23, 2005 by compwhizmm90 Quote Link to comment Share on other sites More sharing options...
compwhizmm90 Posted November 23, 2005 Share Posted November 23, 2005 I think I installed this succesfully. But now all of my images show up really big. I adjusted the image sizes in the admin section but it did not work. Also, is there supposed to be a special admin menu for this? I don't see it in my config list. The "Product Information Image Width" option is there but I don't see another seperate menu. Also my images do not point to imagemagic.php. I would like to use this because all of the features but I can't get it to work. Ok I got the admin section to work. I had not copied all of the sql code. My images are also the correct sizes. But, my images still are not being being resized. There isn't anything in the thumbnail folder and the image urls do not contain imagemagic.php. Please help! Thanks!!! Quote Link to comment Share on other sites More sharing options...
timinark Posted November 23, 2005 Share Posted November 23, 2005 Hi Tim You should read the posts above, they will probably answer your question. Check image setup that you don't have both width and heights set. Also see my above posts regarding windows. Try to turn caching off first. Aaron Server caching did it for me. I turned it off, all is well. Awesome contribution. Super easy installation ( that they could all be so easy! ) I went from a 100 sec load time ( at 28.8) to under 40 seconds ( still tweaking!) Thanks Tim Quote 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.