The problem with image_lib |
[eluser]codeDeveloper[/eluser]
Hi, I use image_lib to create preview image. Code: $config['image_library'] = 'gd2'; If the image is less than 640 * 480, it stretches to 640 * 480, how fix this problem? Unfortunately, the solutions are not found in the documentation.
[eluser]dmorin[/eluser]
If you have $config['maintain_ratio'] = TRUE; then the image library should never stretch the original image to fit a new aspect ratio. Can you also post the actual full code you're using so we can attempt to recreate the problem.
[eluser]codeDeveloper[/eluser]
Spread full code Controller Code: <?php Model Code: <?php Views think you do not need to spread Example: http://dev.icq-mobi.ru/resize/
[eluser]dmorin[/eluser]
Thanks. What are the dimensions of the original image you're using and what version of CI?
[eluser]codeDeveloper[/eluser]
Please see the example that I gave http://dev.icq-mobi.ru/resize/ there is an image 16 * 16 and you can see that it stretches. Using CodeIgniter 1.7
[eluser]srisa[/eluser]
From what I understand of Image_lib library, images do stretch. And link provided by you is a working example of that. If you have access to the dimensions of the image beforehand , ensure that they are not less than 640/480. Or you can tinker with Image_lib library, orig_width and orig_height variables store the width and height of the original image.
[eluser]dmorin[/eluser]
Not sure I understand. It get's larger, but it's not stretching it to 640 * 480 as you originally said. If you're resizing it, of course it's going to be larger! Are you just wondering how to prevent the image from being enlarged?
[eluser]dmorin[/eluser]
try Code: <?php Edit: Moved the load image library out of the first if statement...oops. Also, I haven't actually tested this...there may be other errors. This is just a guide.
[eluser]codeDeveloper[/eluser]
Thanks. I think there is any option which is responsible for such behavior, as well as changing the size of the big party is usually not used.
|
Welcome Guest, Not a member yet? Register Sign In |