Hastie Posted June 25, 2010 Posted June 25, 2010 Hi, I have a problem with images of oscommerce. The problem is I want to resize the images of product listing(small images), and I know I can modify the code (SMALL_IMAGE_WIDTH & SMALL_IMAGE_HEIGHT), but I need two diferents sizes, one for images on portrait mode, and other for landscape. How can I do that? Thx for replys , and sorry for my english.
MrPhil Posted June 25, 2010 Posted June 25, 2010 The current code should be preserving the original image's aspect ratio, just reducing it to fit inside the given box limits. Are you experiencing something different? It should not distort the image to exactly fill the SMALL_IMAGE box. I haven't looked at the code to be sure, but I suppose the PHP code that uses SMALL_IMAGE_WIDTH and _HEIGHT could be modified to look at the original image's dimensions, and if the original image is taller than wide (portrait), use the larger of the constants for height and the smaller for width (and vice-versa for landscape). The alternative would be to define SMALL_IMAGE_PORTRAIT_WIDTH and _HEIGHT constants, and SMALL_IMAGE_LANDSCAPE_WIDTH and _HEIGHT constants, and again choose which to use based on the aspect ratio of the original image. Either might make a good add-on project for someone!
Hastie Posted June 28, 2010 Author Posted June 28, 2010 The current code should be preserving the original image's aspect ratio, just reducing it to fit inside the given box limits. Are you experiencing something different? It should not distort the image to exactly fill the SMALL_IMAGE box. I haven't looked at the code to be sure, but I suppose the PHP code that uses SMALL_IMAGE_WIDTH and _HEIGHT could be modified to look at the original image's dimensions, and if the original image is taller than wide (portrait), use the larger of the constants for height and the smaller for width (and vice-versa for landscape). The alternative would be to define SMALL_IMAGE_PORTRAIT_WIDTH and _HEIGHT constants, and SMALL_IMAGE_LANDSCAPE_WIDTH and _HEIGHT constants, and again choose which to use based on the aspect ratio of the original image. Either might make a good add-on project for someone! Thanks for your reply MrPhil. The code isn't preserving the original aspect ratio, I`ve tested it, but you have a good idea, I will create some diferents constants and use the most adequate.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.