TheExterminator Posted February 28, 2006 Share Posted February 28, 2006 Hi Michael,I had a look and see i/m working on all other pages except your popup page. I think the reason may have to do with the fact that you have the seo switched on. Try turning this off and let me know if it works now. Regards creating images directories, you just need to create ONE. Under your stores root. Tom Hey Tom Where Can I Find The "seo" ????? I Can Not Find It Ind The Admin. Quote Link to comment Share on other sites More sharing options...
ketaz Posted February 28, 2006 Share Posted February 28, 2006 Hi. I use the IM contrib successfully for quite a time now, however having quite a lot of images and quite lot of traffic even with caching enabled I suffer severe performance problems. I believe this is caused by having to query the database twice (select and update LAST_HASH in the DB) with each image call (<img src=imagemagic.php...>). If I have 20 images on product listing page, I am executing extra 40 queries! Correct me if i'm wrong. My idea would be to select and update LAST_HASH only once per page generation ... hash would apply to all images in the scope of the generated page. All ideas on how to work this around greatly appreciated :thumbsup: Thanks, Julo Quote Link to comment Share on other sites More sharing options...
sidobush Posted February 28, 2006 Share Posted February 28, 2006 (edited) Hello. I have a question according the installation of "image magic. Regarding to the manual, the file "catalog/admin/includes/functions/html_output.php" should be backuped. But why? Only "catalog/includes/functions/html_output.php" has to be changed, hasn?t it? Or has the "tep_image() function" to be replaced in both php files and it just wasn?t written down? Thank you! It?s a great contribution and i want it to work ;) Edited February 28, 2006 by sidobush Quote Link to comment Share on other sites More sharing options...
tomjmul Posted February 28, 2006 Author Share Posted February 28, 2006 My idea would be to select and update LAST_HASH only once per page generation ... hash would apply to all images in the scope of the generated page. All ideas on how to work this around greatly appreciated Impossible. There is no 'page scope' and none is possible. I/m is called via the <img> tag and each seperate tag is a seperate script execution from beginning to end. I will be looking into some optimizations for the next version which I am currently working on, but your idea will / can not be one of them. I have a question according the installation of "image magic.Regarding to the manual, the file "catalog/admin/includes/functions/html_output.php" should be backuped. But why? Only "catalog/includes/functions/html_output.php" has to be changed, hasn?t it? Or has the "tep_image() function" to be replaced in both php files and it just wasn?t written down? What!?! You mean you have actually read that thing.....well that certainly makes a change :D Anyway, you are quite correct. The admin side does not need to be backed up or changed. That is a hang-over from the first version which I did have i/m working within the admin area also. For the sake of simplicity, I stripped this functionality out in subsequent versions. Tom Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
TheExterminator Posted February 28, 2006 Share Posted February 28, 2006 Hi Michael,I had a look and see i/m working on all other pages except your popup page. I think the reason may have to do with the fact that you have the seo switched on. Try turning this off and let me know if it works now. Regards creating images directories, you just need to create ONE. Under your stores root. Tom Hey Tom Where Can I Find The "seo" ????? I Can Not Find It Ind The Admin. Quote Link to comment Share on other sites More sharing options...
ketaz Posted February 28, 2006 Share Posted February 28, 2006 Impossible. There is no 'page scope' and none is possible. I/m is called via the <img> tag and each seperate tag is a seperate script execution from beginning to end. Hi Tom, thank you for swift response, though a negative one. I already solved the matter by "shuffle, regroup & tweak" method. Here's what I've done: 1. take db query and HASH evaluation out of imagemagic.php and call it from application_top.php (separate include file to maintain clarity of code) 2. if LAST_HASH and $append_hash don't equal, re/generate a plain PHP file with dump of cfg defines (called imagemagic_cfg_dump.php in my case) and ofcourse update the DB with current LAST_HASH 3. in imagemagic.php don't execute any queries, just include imagemagic_cfg_dump.php (which is either unchanged or already fresh from application_top) Simple, effective, working :thumbsup: Quote Link to comment Share on other sites More sharing options...
TheExterminator Posted February 28, 2006 Share Posted February 28, 2006 Hey Tom Where Can I Find The "seo" ????? I Can Not Find It Ind The Admin. The "SEO" Is Turn Off Now, And Is Not Working, PLease Help Me Again Tom. You Can Get The Login And Pass To The Admin, And Take A Look In There. Quote Link to comment Share on other sites More sharing options...
mamram Posted February 28, 2006 Share Posted February 28, 2006 Hi Tom, I've tried changing the W/H parameters OTF via the URL like this just for the fun: Original: /imagemagic.php?img=...&w=180&h=200&page= Modified: /imagemagic.php?img=...&w=999999999&h=42795765&page= And the hosting company suspended my account for killing the web server! :D Why won't you check/limt the input for this parameters? Quote Link to comment Share on other sites More sharing options...
ketaz Posted February 28, 2006 Share Posted February 28, 2006 (edited) I've tried changing the W/H parameters OTF via the URL like this just for the fun:... And the hosting company suspended my account for killing the web server! :D Why won't you check/limt the input for this parameters? This is a critical issue. Quick remedy untill Tom fixes the base code trunk: in catalog/imagemagic.php just behind the line (around line 50 in untweaked file) elseif ($_GET['w'] == SUBCATEGORY_IMAGE_WIDTH || $_GET['h'] == SUBCATEGORY_IMAGE_HEIGHT) $thumbnail_size=3; add this line elseif (($_GET['w'] > 2500) || ($_GET['h'] > 2500)) die('Wrong W/H parameters. Check imagemagic size constraints!'); This tweak makes sure no images set above 2500px W or H will be processed. Modify 2500 constant to meet your needs. Julo Edited February 28, 2006 by ketaz Quote Link to comment Share on other sites More sharing options...
mamram Posted February 28, 2006 Share Posted February 28, 2006 add this line elseif (($_GET['w'] > 2500) || ($_GET['h'] > 2500)) die('Wrong W/H parameters. Check imagemagic size constraints!'); This tweak makes sure no images set above 2500px W or H will be processed. Modify 2500 constant to meet your needs. Julo Thanks. I've already fixed it for my install. I've just wondered how Tom, the coding master, forgot to check for the correct input!!! :P Quote Link to comment Share on other sites More sharing options...
tomjmul Posted February 28, 2006 Author Share Posted February 28, 2006 Hi Tom, I've tried changing the W/H parameters OTF via the URL like this just for the fun: Original: /imagemagic.php?img=...&w=180&h=200&page= Modified: /imagemagic.php?img=...&w=999999999&h=42795765&page= And the hosting company suspended my account for killing the web server! :D Why won't you check/limt the input for this parameters? LOL, had a good laugh at that. As long as you had your fun....let the hosting company go to hell :D Anyway, I have considered the D.O.S problem and provided this feature. There is an option in the admin section not to allow image sizes larger than the original. :P right back at ya. :D ketaz, I have had a really busy day, and it has taken me a while to get my head around your proposal. Although I can see some merit in it, I am not altogether sure the solution is either general enough or indeed worth it. 1. The issue of creating and writing files on the server has a direct relationship to the volume of support requests in this thread. 2. Another file would need to be tampered with at install. 3. I am not convinced that file reads I.E php includes would be (all that, if at all) faster than a straight database access with persistant connections. Maybe if you are keen enough, you might, out of interest, generate some benchmark figures. PHP does, if my memory serves me right, have some persistant memory capabilities across script executions and perhaps I will look into this. TheExterminator: p/m me your details. Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
TheExterminator Posted February 28, 2006 Share Posted February 28, 2006 TheExterminator: p/m me your details. You Have A PM Quote Link to comment Share on other sites More sharing options...
tomjmul Posted February 28, 2006 Author Share Posted February 28, 2006 (edited) Ketaz, Just one other thing that might help with your optimization; as far as my depth of reason allows at this time, it occurs to me that there does not need to be any queries in your application_top with regards to i/m All i/m config vars should already be available here as a result of native osc code. Tom Edited February 28, 2006 by tomjmul Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
mamram Posted February 28, 2006 Share Posted February 28, 2006 (edited) Anyway, I have considered the D.O.S problem and provided this feature. There is an option in the admin section not to allow image sizes larger than the original. Hehe :D I can see it now. BTW, whats the point of the image file name encryption? just to hide the path? Edited February 28, 2006 by mamram Quote Link to comment Share on other sites More sharing options...
tomjmul Posted February 28, 2006 Author Share Posted February 28, 2006 Hehe :D I can see it now. BTW, whats the point of the image file name encryption? just to hide the path? Well there would be no point watermarking your images, if the path name is shown in the url for anyone to just type it into the browser bar and steal the original unwatermarked version. That was my thinking anyway. 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 March 1, 2006 Author Share Posted March 1, 2006 Michael, please don't keep sending me PMs and forum messages telling me I have PMs. I will deal with your problem when I get a chance and feel like it. If you want to pay me to sort out your problems, then I will make time, otherwise you'll just have to wait. That is the nature of providing free support unfortunately. Tom Tom Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
ketaz Posted March 1, 2006 Share Posted March 1, 2006 ... it occurs to me that there does not need to be any queries in your application_top with regards to i/mAll i/m config vars should already be available here as a result of native osc code. Tom Tom, indeeed I/M vars are available, however without hardcoding their names there's no way of sellecting and writting them to the include file (not having the config group id as we have in query). Therefore we have to run the query. Re the speed (your previous post): Simple repetitive include in PHP is zillions times faster than repetitive MySQL connect-select. Using pconnect doesn't make it much better, pconnect itself being rather problematic for many. I'm not any PHP guru myself but I believe repetitve including of the same file would be cached. However I am still not satisfied with the performance of my installation and will be looking into optimizing OSC+IM further. I will consult with you any major tweaks, thanks in advance for your comments / remarks / guidance. Julo Quote Link to comment Share on other sites More sharing options...
tomjmul Posted March 2, 2006 Author Share Posted March 2, 2006 Julo, Yes, please do. All feedback is very much appreciated. If you're thinking is along the lines of personal rather than general optimizations, perhaps you should look in to modifying the image output function in html_output. See page 18 and the dialog I had with doc_uk about intercepting imagemagic if the image already exists in the cache. What about not even doing a file_exists check, but instead in html_output just unconditionally spitting out the <img src> tag for what the cached filename should be if it was in there. Then instead of ever calling i/m directly, tweak it and then set apache up so that it is called as a result of a 404. That way, it would not interfere ever again unless an image needed to be rebuilt or built in the first place. You could also then pre-build the cache using a webcrawling program. Tom Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
ketaz Posted March 2, 2006 Share Posted March 2, 2006 (edited) ...If you're thinking is along the lines of personal rather than general optimizations, perhaps you should look in to modifying the image output function in html_output. See page 18 and the dialog I had with doc_uk about intercepting imagemagic if the image already exists in the cache. ... Tom Thanks, what you & doc_uk came out with works perfectly and boosts performance 100%. However I can't afford to loose the filename encryption and must serve images with imagemagic.php rather than showing the direct path. There must be something in imagemagic.php that takes up too much CPU time even with image already existing. My current 2dos for this file are: - make sure there's no calculate/resample/combine math going on if file already exists - try to minimize all other redundant operations, just serve the file if it exists Will keep you posted, Julo Edited March 2, 2006 by ketaz Quote Link to comment Share on other sites More sharing options...
TheExterminator Posted March 2, 2006 Share Posted March 2, 2006 Michael, please don't keep sending me PMs and forum messages telling me I have PMs. I will deal with your problem when I get a chance and feel like it. If you want to pay me to sort out your problems, then I will make time, otherwise you'll just have to wait. That is the nature of providing free support unfortunately. Tom Tom Sorry, But i get a error first time i send it to you. :( I have fix the probs. i have whit the thumbnails, I only probs. now is the watertext, i can not get the text over the picture in the popup. So it the only one i need help to now. http://the-exterminator.dk/fido Quote Link to comment Share on other sites More sharing options...
tomjmul Posted March 2, 2006 Author Share Posted March 2, 2006 (edited) Sorry, But i get a error first time i send it to you. :( I have fix the probs. i have whit the thumbnails, I only probs. now is the watertext, i can not get the text over the picture in the popup. So it the only one i need help to now. http://the-exterminator.dk/fido Yeah, don't worry about it. Anyway, I fixed your site. The problem is that you were using that mopics contribution which does not call the tep_image function. I can tell you that editing php code using the osc filemanager is certainly no fun :) Best wishes and good luck with the site Tom P.S remember that text or image watermarking does not work well with GIF images (there aren't enough colours in them) Edited March 2, 2006 by tomjmul Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
TheExterminator Posted March 2, 2006 Share Posted March 2, 2006 Yeah, don't worry about it. Anyway, I fixed your site. The problem is that you were using that mopics contribution which does not call the tep_image function. I can tell you that editing php code using the osc filemanager is certainly no fun :) Best wishes and good luck with the site Tom P.S remember that text or image watermarking does not work well with GIF images (there aren't enough colours in them) Hey Tom. Thanks Alot. But Work The mopics ????? Quote Link to comment Share on other sites More sharing options...
tomjmul Posted March 2, 2006 Author Share Posted March 2, 2006 Hey Tom. Thanks Alot. But Work The mopics ????? yes Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing Link to comment Share on other sites More sharing options...
TheExterminator Posted March 2, 2006 Share Posted March 2, 2006 (edited) yes Thanks Alot Tom, And Damn A Nick Module You Have Make There. Can .gif Absolute Not Work. ??? Never Work. ??? Thanks Alot For You Take The Time Tom. Edited March 2, 2006 by TheExterminator Quote Link to comment Share on other sites More sharing options...
tomjmul Posted March 2, 2006 Author Share Posted March 2, 2006 (edited) Thanks Alot Tom, And Damn A Nick Module You Have Make There. Can .gif Absolute Not Work. ??? Never Work. ??? Thanks Alot For You Take The Time Tom. You're welcome. I have programmed the script to completely disable image watermarks in gifs, but text watermarks will be applied. If you look at your popup image now, you will see there is a text watermark on it, but it is crap. Because gifs only have 256 colours, the text cannot be made semi-transparent or anti-aliased onto the image. It is your choice whether to use text w/m with gif images, but I personally wouldn't Edited March 2, 2006 by tomjmul Quote OSC Image Magic On-the-fly thumbnails, watermarks and image processing 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.