webmaster69 Posted February 14, 2007 Posted February 14, 2007 I have searched all the contributions and help topics before posting this as I didn’t want to ask for help when the topic had already been covered. Even if I set my digital camera to the minimum resolution the photos are way too big and take up more than a full screen. I have to reduce the image size then upload them, which is time consuming and very boring. I do not have an issue with thumbnails for which there is loads of support. Is there a way I can simply use the photos straight from my camera and OScommerce resamples the image within a set of predefined parameters. I would have thought this was a basic requirement, perhaps I have missed something? Thanks
davidinottawa Posted February 14, 2007 Posted February 14, 2007 I have searched all the contributions and help topics before posting this as I didn’t want to ask for help when the topic had already been covered. Even if I set my digital camera to the minimum resolution the photos are way too big and take up more than a full screen. I have to reduce the image size then upload them, which is time consuming and very boring. I do not have an issue with thumbnails for which there is loads of support. Is there a way I can simply use the photos straight from my camera and OScommerce resamples the image within a set of predefined parameters. I would have thought this was a basic requirement, perhaps I have missed something? I think you are missing something. Admin --> My Store --> Images --> Small Image Width. if you set the width, and leave the height blank, the image will display in its proper ratio. and BTW - this is a GREAT application to resize images: http://www.rw-designer.com/picture-resize All you do is dump the application on your desktop, and *rename* the actual executable file to the size you want your images to be - height and width are the same varaible. So - rename the file photresizer800.exe - all your images resize to max value of 800 px. Rename the file photresizer200.exe - all your images resize to max value of 200 px. All you do is drag and drop single images, multiple images - or even just an entire directory. It's SOO fast - and so easy! davidinottawa
webmaster69 Posted February 14, 2007 Author Posted February 14, 2007 Thanks for the reply I don't have a problem with image ratio. I simply have a problem with resizing every image before uploading it. I will look at BTW but I was really hoping to simply use an image directly from my camera straight into OS commerce and for it to appear within a set of parameters. I think you are missing something. Admin --> My Store --> Images --> Small Image Width. if you set the width, and leave the height blank, the image will display in its proper ratio. and BTW - this is a GREAT application to resize images: http://www.rw-designer.com/picture-resize All you do is dump the application on your desktop, and *rename* the actual executable file to the size you want your images to be - height and width are the same varaible. So - rename the file photresizer800.exe - all your images resize to max value of 800 px. Rename the file photresizer200.exe - all your images resize to max value of 200 px. All you do is drag and drop single images, multiple images - or even just an entire directory. It's SOO fast - and so easy! davidinottawa
davidinottawa Posted February 14, 2007 Posted February 14, 2007 Thanks for the reply I don't have a problem with image ratio. I simply have a problem with resizing every image before uploading it. I will look at BTW but I was really hoping to simply use an image directly from my camera straight into OS commerce and for it to appear within a set of parameters. you can
Velveeta Posted February 14, 2007 Posted February 14, 2007 you can I think what he's referring to is that on some digital cameras, you take a picture, and the full size image is like a billion by a billion pixels, so even if he's got a thumbnail contribution installed, when they click to view the full sized image, it's still way too big for their screen, so he'd like to shrink the full-sized pics down to say, 300 x 600 or something, without having to shrink them all down manually... My advice for you webmaster, is to take whatever thumbnailing contribution you've got, and incorporate it into your product image upload function in categories.php in the admin console, with some different size threshholds... That way, when you upload the image, the same proportion ratios are used like it would do to size down to a thumbnail, but it would use different limits to resize that pic on the fly during the upload and saving process, and write the resized large image to the disk automatically rather than the full-sized one... Richard. Richard Lindsey
davidinottawa Posted February 14, 2007 Posted February 14, 2007 I think what he's referring to is that on some digital cameras, you take a picture, and the full size image is like a billion by a billion pixels, so even if he's got a thumbnail contribution installed, when they click to view the full sized image, it's still way too big for their screen, so he'd like to shrink the full-sized pics down to say, 300 x 600 or something, without having to shrink them all down manually Ah right. Good point Richard. david
Velveeta Posted February 14, 2007 Posted February 14, 2007 Ah right. Good point Richard. david Although one other suggestion... Doesn't that camera have a resolution setting on it? I mean even if it's say, an 8 megapixel camera, can't you set it to a lower resolution so that the pics only come out a certain size? Richard. Richard Lindsey
webmaster69 Posted February 14, 2007 Author Posted February 14, 2007 Hi Richard You are exactly right. It is an 8 megapixel camera like most cameras are now a days. Even if I set it to the lowest resolution setting the images are still too large. The thumbs don't work, a white box with a red cross is displayed. When you click where the thumb should be to displayed the full size image that appears is very big (too big for the screen). So this looks like it could be a problem for most people in the future. It's easy to overcome by simply reducing the image size before it is used, but as I said before it's a boring time consuming job and just one more little job to do. I would be open to any suggestions and maybe post in in the contributions because I can't seem to find the answer anywhere. Although one other suggestion... Doesn't that camera have a resolution setting on it? I mean even if it's say, an 8 megapixel camera, can't you set it to a lower resolution so that the pics only come out a certain size? Richard.
davidinottawa Posted February 14, 2007 Posted February 14, 2007 The thumbs don't work, a white box with a red cross is displayed. This means you're not uploading into the right directory. It's easy to overcome by simply reducing the image size before it is used, but as I said before it's a boring time consuming job This app should take you about 60 seconds to do one hundred images : http://www.rw-designer.com/picture-resize Not exactly time consuming!
webmaster69 Posted February 14, 2007 Author Posted February 14, 2007 Thanks davidinottawa for taking the time to reply, This looks good. In practice though I update the store one product at time throughout the day and not in batches. I know this may sound counter productive but this tends to work best for me. So although it's straight forward to use this sofware it's another process to remember. I like the idea that Richard raised but unfortuneately I wouldn't know where to start. This means you're not uploading into the right directory. This app should take you about 60 seconds to do one hundred images : http://www.rw-designer.com/picture-resize Not exactly time consuming!
Guest Posted February 14, 2007 Posted February 14, 2007 I too am looking for a solution to this problem, at the moment I've got people using photo shop, paint shop pro and a whole number of different spyware infected free photo resizing tools. I'm getting people uploading images too small, im getting images uploaded with the wrong aspect ratio, its an absolute nightmare. When someone uploads an image to the site all I want is the system to resize images to a predefined resolution whilst preserving aspect ratio. I just don't understand why this feature doesn't exist. It know its possible because the system resizes images to make thumbnails. The problem with this support forum is its impossible to search for anything so unless someone replies we're never gonna find out if such a mod exists.
Velveeta Posted February 14, 2007 Posted February 14, 2007 I too am looking for a solution to this problem, at the moment I've got people using photo shop, paint shop pro and a whole number of different spyware infected free photo resizing tools. I'm getting people uploading images too small, im getting images uploaded with the wrong aspect ratio, its an absolute nightmare. When someone uploads an image to the site all I want is the system to resize images to a predefined resolution whilst preserving aspect ratio. I just don't understand why this feature doesn't exist. It know its possible because the system resizes images to make thumbnails. The problem with this support forum is its impossible to search for anything so unless someone replies we're never gonna find out if such a mod exists. I'm not sure what you mean about it being impossible to search for anything... I search for things all the time, quite successfully... However, now that 2 people have made the same feature request, I'll see about writing a contribution for it at some point today when my work isn't too heavy, it shouldn't take too long... However, those of you that complain that this should be a standard feature, should think about the pace of technology... This software is around 5 years old now, and the only additions to it over that time have been bugfix releases, not feature additions... 5 years ago when this was released, people didn't have 8 megapixel cameras, so this kind of thing wasn't an issue back then, which is why it's not a standard feature... In the osc MS3 release which is still forthcoming, I do believe there is a feature that allows you to set small/medium/large image sizes and it will resize things automatically at the time of upload... It's a pretty sweet little backend they've got going on so far :) However, for those 99.9% of people that are running MS2 right now, I'll write up a contribution as soon as I have the time, and I'll post back here with a link to it when it's uploaded. Richard. Richard Lindsey
webmaster69 Posted February 15, 2007 Author Posted February 15, 2007 Richard Thanks for the reply I could hardly believe my eyes when I read you were to write a contribution for this. I wasn't complaining about this not been a standard feature. As I mentioned earlier I can understand how this has come about and that it wasn't an issue before high resolution cameras were available. I can see this new contribution been heavily used in the future as this will be a problem that most OCcommerce users will face. Keep up the good work, it is very much appreciated. now that 2 people have made the same feature request, I'll see about writing a contribution for it at some point today when my work isn't too heavy, it shouldn't take too long... However, those of you that complain that this should be a standard feature, should think about the pace of technology... I'll write up a contribution as soon as I have the time, and I'll post back here with a link to it when it's uploaded. Richard.
davidinottawa Posted February 15, 2007 Posted February 15, 2007 It know its possible because the system resizes images to make thumbnails. This is actually not true. I'm sure someone will correct me if I'm wrong - but all the OSC does is put in width and height tags around yourr img src tag : <img src width=<max value> height=<max value> It doesn't do anything to the file itself. The problem with this support forum is its impossible to search for anything so unless someone replies we're never gonna find out if such a mod exists. Huh ? Perhaps the problem is you don't know what to search for ? Perhpas your knowledge of the technical terms is hindering your use of the search tool to effecitively get accurate results. In my 15 years of being online and participating in everyting from BBS help for Pagesus mail, to low level programming forums - this forum is one of the most helpful communittees I have ever come across. A LOT of other technical forums are wrought with people that have major arrogance issues that come through in their replies - this rarely occurs here. Just my blathering 2 cents! davidinotttawa
Nigelspost Posted February 15, 2007 Posted February 15, 2007 This is exactly the problem I have. I eagly await Richards Contribution. :rolleyes: :thumbsup: Nigel
HappyWeb Posted February 16, 2007 Posted February 16, 2007 Hi everyone, This thread seems to have come to a stand still. Rather than putting all the pressure on poor Richard to come up with something, is there anyone else who perhaps could lend a helping hand. I am also have also got this issue as I would guess many others have. Cheers Tom
davidinottawa Posted February 16, 2007 Posted February 16, 2007 Hi everyone, This thread seems to have come to a stand still. Rather than putting all the pressure on poor Richard to come up with something, is there anyone else who perhaps could lend a helping hand. I am also have also got this issue as I would guess many others have. Cheers Tom It's a pretty easy fix. I could make a go of it this weekend - Richard - I sent you a PM yesterday saying this. Let me know what you think. d
Velveeta Posted February 16, 2007 Posted February 16, 2007 It's a pretty easy fix. I could make a go of it this weekend - Richard - I sent you a PM yesterday saying this.Let me know what you think. d Sorry guys! I did mean to get to this the other day, I came down with a UTI and was out and about all day yesterday at the doctor's and then filling prescriptions, I will get to this today though, it shouldn't be too hard to whip out... David, I did get your email from the other day (this morning :D) and do appreciate the backup offer... If I find I've got no time to do it, I'll let you know... Since you've got gmail as well, I'm gonna send you an email from my own so we can hit each other up on gmail chat whenever either of us may need assistance, since we both seem to be fairly knowledgeable fellows :D Richard. Richard Lindsey
worldwidetrading Posted February 16, 2007 Posted February 16, 2007 Sorry guys! I did mean to get to this the other day, I came down with a UTI and was out and about all day yesterday at the doctor's and then filling prescriptions, I will get to this today though, it shouldn't be too hard to whip out... David, I did get your email from the other day (this morning :D) and do appreciate the backup offer... If I find I've got no time to do it, I'll let you know... Since you've got gmail as well, I'm gonna send you an email from my own so we can hit each other up on gmail chat whenever either of us may need assistance, since we both seem to be fairly knowledgeable fellows :D Richard. I have installed a contribution on my site called "auto thumbnailer". This contribution automatically changes the image size to the correct size on the fly without ever having to modify a single image. Based on OsCommerce 2.2 MS2 - Mods Including: Customer Approval, STS Template System, OS-CMS, Sage Line 50 Sync, Locate a Stockist, Auto Thumbnailer, Easy Populator, Visitors Stats, Extra Images, Header Tags Controller, Unsold Cart, Products w/o Description/Prices/Images Reports, Backup Customers Table, Login to See Prices. Full customised products_info.php page. OSC Links Manager. Minimum Order Amount. Visitor Web Stats. Google Sitemap. All products page (user sitemap). The OsCommerce Site is hosted on 1 domain with 20 feeder domains extracting data from OS-CMS & the shop catalogue. If you would like to view my website in relation to any of my posts you can google my forum username to find my URL or add a (dot)co(dot)uk to the end of it.
HappyWeb Posted February 16, 2007 Posted February 16, 2007 Thumbnails are not the issue here it. It is the product image. Does this package also resize the image in the popup? or does it just deal with the thumbnail?? I have installed a contribution on my site called "auto thumbnailer".This contribution automatically changes the image size to the correct size on the fly without ever having to modify a single image.
Velveeta Posted February 17, 2007 Posted February 17, 2007 Alllllllllllllrighty then... I had some downtime at work, so I put this together... However, I don't have my codebase to test it on, and it was all done in notepad, so I can't make any promises... However, if anyone wants to try this and get back to me with the results asap, I can probably fix it up before I leave work... This is spliced together with parts of the on-the-fly thumbnailer that I use, but will pull from a new value in your admin for large images, located in the same section as the value for small images, subcategory images, etc... Just set the new large image value to whatever you want the max size to be, height and width, and the code will determine which dimension needs to be used to set the proportion, and shrink them both down proportionally to fit within that height/width range... If an uploaded image is smaller than both threshholds, it's left untouched (so it doesn't pixellate it by blowing it up in proportion)... Now, I repeat, this hasn't been tested, but it should be safe, barring maybe a syntax or parse error I might have missed... And it should take all of about 30 seconds to install, and is an easy uninstall if it's not working for you, as it's all in 1 block of code... First, run the following sql in phpmyadmin or your method of choice for importing database entries: INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Large Image Width', 'LARGE_IMAGE_WIDTH', '600', 'The maximum pixel width of full-sized images', '4', '0', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Large Image Height', 'LARGE_IMAGE_HEIGHT', '80', 'The maximum pixel height of full-sized images', '4', '0', now()); Then, just install this one code block in admin/categories.php... In the switch statement at the top of the file, where you'll find update_category, move_product, etc... Find the entry for "case 'new_product_preview':"... Within that section, you'll see this by default: // copy image only if modified $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } Right underneath the line in the if block that says "$products_image_name = $products_image->filename;", add this: // Get the size of the image: $image = @getimagesize(DIR_FS_CATALOG_IMAGES . $products_image_name); // Check the input variables and decide what to do: if (!empty($image) && !empty($image[0]) && !empty($image[1]) && ($image[0] > LARGE_IMAGE_WIDTH || $image[1] > LARGE_IMAGE_HEIGHT)) { $width = $image[0]; $height = $image[1]; // Set the width and height to the proper ratio if ((LARGE_IMAGE_WIDTH / $width) > (LARGE_IMAGE_HEIGHT) / $height) { $targetwidth = LARGE_IMAGE_WIDTH; $targetheight = intval(LARGE_IMAGE_WIDTH / $width * $height); } elseif ((LARGE_IMAGE_WIDTH / $width) < (LARGE_IMAGE_HEIGHT) / $height) { $targetheight = LARGE_IMAGE_HEIGHT; $targetwidth = intval(LARGE_IMAGE_HEIGHT / $height * $width); } else { $targetwidth = LARGE_IMAGE_WIDTH; $targetheight = LARGE_IMAGE_HEIGHT; } $filename = DIR_FS_CATALOG_IMAGES . $products_image_name; // Create a new, empty image based on settings: if (function_exists('imagecreatetruecolor') && ($image[2] == 2 || $image[2] == 3)) { $tmp_img = imagecreatetruecolor($width,$height); } else { $tmp_img = imagecreate($width,$height); } $th_bg_color = imagecolorallocate($tmp_img, 255, 255, 255); imagefill($tmp_img, 0, 0, $th_bg_color); imagecolortransparent($tmp_img, $th_bg_color); // Create the image to be scaled: if ($image[2] == 2 && function_exists('imagecreatefromjpeg')) { $src = imagecreatefromjpeg($filename); } elseif ($image[2] == 1 && function_exists('imagecreatefromgif')) { $src = imagecreatefromgif($filename); } elseif (($image[2] == 3 || $image[2] == 1) && function_exists('imagecreatefrompng')) { $src = imagecreatefrompng($filename); } // Scale the image based on settings: if (function_exists('imagecopyresampled')) { imagecopyresampled($tmp_img, $src, 0, 0, 0, 0, $targetwidth, $targetheight, $width, $height); } else { imagecopyresized($tmp_img, $src, 0, 0, 0, 0, $targetwidth, $targetheight, $width, $height); } // Output the image: if ($image[2] == 2 || ($image[2] == 1 && !function_exists('imagegif'))) { imagejpeg($tmp_img, $filename, 100); } elseif ($image[2] == 1 && function_exists('imagegif')) { imagegif($tmp_img, $filename); } elseif ($image[2] == 3 || $image[2] == 1) { imagepng($tmp_img, $filename, 100); } // Clear the image from memory: imagedestroy($src); imagedestroy($tmp_img); } So that the final new_product_preview section should look like this: case 'new_product_preview': // copy image only if modified $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; // Get the size of the image: $image = @getimagesize(DIR_FS_CATALOG_IMAGES . $products_image_name); // Check the input variables and decide what to do: if (!empty($image) && !empty($image[0]) && !empty($image[1]) && ($image[0] > LARGE_IMAGE_WIDTH || $image[1] > LARGE_IMAGE_HEIGHT)) { $width = $image[0]; $height = $image[1]; // Set the width and height to the proper ratio if ((LARGE_IMAGE_WIDTH / $width) > (LARGE_IMAGE_HEIGHT) / $height) { $targetwidth = LARGE_IMAGE_WIDTH; $targetheight = intval(LARGE_IMAGE_WIDTH / $width * $height); } elseif ((LARGE_IMAGE_WIDTH / $width) < (LARGE_IMAGE_HEIGHT) / $height) { $targetheight = LARGE_IMAGE_HEIGHT; $targetwidth = intval(LARGE_IMAGE_HEIGHT / $height * $width); } else { $targetwidth = LARGE_IMAGE_WIDTH; $targetheight = LARGE_IMAGE_HEIGHT; } $filename = DIR_FS_CATALOG_IMAGES . $products_image_name; // Create a new, empty image based on settings: if (function_exists('imagecreatetruecolor') && ($image[2] == 2 || $image[2] == 3)) { $tmp_img = imagecreatetruecolor($width,$height); } else { $tmp_img = imagecreate($width,$height); } $th_bg_color = imagecolorallocate($tmp_img, 255, 255, 255); imagefill($tmp_img, 0, 0, $th_bg_color); imagecolortransparent($tmp_img, $th_bg_color); // Create the image to be scaled: if ($image[2] == 2 && function_exists('imagecreatefromjpeg')) { $src = imagecreatefromjpeg($filename); } elseif ($image[2] == 1 && function_exists('imagecreatefromgif')) { $src = imagecreatefromgif($filename); } elseif (($image[2] == 3 || $image[2] == 1) && function_exists('imagecreatefrompng')) { $src = imagecreatefrompng($filename); } // Scale the image based on settings: if (function_exists('imagecopyresampled')) { imagecopyresampled($tmp_img, $src, 0, 0, 0, 0, $targetwidth, $targetheight, $width, $height); } else { imagecopyresized($tmp_img, $src, 0, 0, 0, 0, $targetwidth, $targetheight, $width, $height); } // Output the image: if ($image[2] == 2 || ($image[2] == 1 && !function_exists('imagegif'))) { imagejpeg($tmp_img, $filename, 100); } elseif ($image[2] == 1 && function_exists('imagegif')) { imagegif($tmp_img, $filename); } elseif ($image[2] == 3 || $image[2] == 1) { imagepng($tmp_img, $filename, 100); } // Clear the image from memory: imagedestroy($src); imagedestroy($tmp_img); } } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } break; Let me know if you find any problems in this, and I'll see what's the matter and let you know what needs to be changed :) Richard. Richard Lindsey
webmaster69 Posted February 17, 2007 Author Posted February 17, 2007 Let me know if you find any problems in this, and I'll see what's the matter and let you know what needs to be changed :) Richard. Hi Richard I have just tried it out and got the following error. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1552 bytes) in /home/sites/click4websites.com/public_html/shop2/catalog/admin/categories.php on line 365 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 310 bytes) in /home/sites/click4websites.com/public_html/shop2/catalog/admin/includes/functions/sessions.php on line 47 Regards Frank
Velveeta Posted February 17, 2007 Posted February 17, 2007 Hi Richard I have just tried it out and got the following error. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1552 bytes) in /home/sites/click4websites.com/public_html/shop2/catalog/admin/categories.php on line 365 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 310 bytes) in /home/sites/click4websites.com/public_html/shop2/catalog/admin/includes/functions/sessions.php on line 47 Regards Frank Hmm, what resolution are you trying to upload? It could be that if it's a gigantic picture, when it's trying to load it in memory, it's exceeding the memory limit... Try adding this: ini_set("memory_limit", "50M"); Right before this: $image = @getimagesize(DIR_FS_CATALOG_IMAGES . $products_image_name); At the start of the new code I posted for categories.php... It should boost your available memory limit... Richard. Richard Lindsey
webmaster69 Posted February 17, 2007 Author Posted February 17, 2007 Hmm, what resolution are you trying to upload? It could be that if it's a gigantic picture, when it's trying to load it in memory, it's exceeding the memory limit... Try adding this: ini_set("memory_limit", "50M"); Right before this: $image = @getimagesize(DIR_FS_CATALOG_IMAGES . $products_image_name); At the start of the new code I posted for categories.php... It should boost your available memory limit... Richard. This has stopped the error The image is been resized but placed in the top left corner within the orginal dimensions. So effectively the image size is the same. Here is the URL of the image that is produced http://click4websites.com/shop2/catalog/po...age.php?pID=550 Regards Frank
webmaster69 Posted February 17, 2007 Author Posted February 17, 2007 Hmm, what resolution are you trying to upload? It is set on the lowest setting 1.8MP
Recommended Posts
Archived
This topic is now archived and is closed to further replies.