I'm using laravel 4.2 image intervention in ubuntu 32 bit. It's working, but image is not resizing for the specified height. Suppose I'm trying to resize image of width=800, height=600
to width=250, height=250
but it is resizing to width=250, height=188
.
I used the following code in my controller.
$imageType = array(
'detail_page' => array(
'width' => 250,
'height' => 250
),
);
$file = Input::file('album_image');
if($file->isValid()) {
$file_name = microtime();
$file_name = str_replace(' ', '_', $file_name);
$file_name = str_replace('.', '_', $file_name);
$file_name = $file_name . '.' . $file->getClientOriginalExtension();
$file->move(public_path() . '/album_uploads/', $file_name);
foreach ($imageType as $key => $value) {
$file = Image::make(sprintf('album_uploads/%s',$file_name))->resize($value['width'], $value['height'],
function($constraint) {
$constraint->aspectRatio();
});
$file->save(public_path().'/album_uploads/'.$value['width'].'X'.$value['height'].'/'. $file_name);
}
$album_image_url = URL::to('album_uploads/' . $file_name);
}