Welcome Guest, Not a member yet? Register   Sign In
upload image : how to fix the dimension height and width ?
#1

[eluser]ludo31[/eluser]
Hello ;
I would like to know ho to fix the dimension of image , I need it for a zoom on thumbnails ; I mean I need for all thumbs that they are (90 x 90 )
I try to create code like this :

Code:
$config['image_library'] = 'gd2';
                        $config['source_image'] = $source;
                        $config['new_image'] = './image/thumbs/';
                        $config['create_thumb'] = TRUE;
                        $config['thumb_marker']='';
                        $config['maintain_ratio'] = TRUE;
                        $config['width'] = 90;
                        $config['height'] = 90;
                        
                         $this->load->library('image_lib', $config);

but when I upload images , for example : there are images when dimensions are 90x90 and there are where 90x85 is it possible to fix it 90x90 without modifying the quality of image
if not how to solve this probleme ???
thanks !!
#2

[eluser]Silviu[/eluser]
The resize method of the Image Manipulation Library will fit your image into the specified dimensions.

You must use the crop method to achieve your goal.
#3

[eluser]ludo31[/eluser]
But I believed that when we put

$config['width'] = 90;
$config['height'] = 90;

it resizes exactly the images Sad

there is a another solution is not to maintain ratio but some images are amazin after !!
#4

[eluser]Matalina[/eluser]
Code:
$config['maintain_ratio'] = TRUE;
This keeps the dimensions in proportion. Change it to false. But it will also stretch the images in the lacking dimesions
#5

[eluser]ludo31[/eluser]
Matalina exactly it s the solution but there is this real problem about the lacking dimensions

may be I keep the maitain_ratio to true
#6

[eluser]Matalina[/eluser]
depending on what size is more impotant to you you can set the width that must be reached the other will be larger or smaller depending on the size of the other dimension.

Quote:master_dim auto auto, width, height Specifies what to use as the master axis when resizing or creating thumbs. For example, let's say you want to resize an image to 100 X 75 pixels. If the source image size does not allow perfect resizing to those dimensions, this setting determines which axis should be used as the hard value. "auto" sets the axis automatically based on whether the image is taller then wider, or vice versa.




Theme © iAndrew 2016 - Forum software by © MyBB