tags:

views:

157

answers:

2

i want to pass the width & height and crop ration in img src tag.My aim is to resolve the problem of the staratching the image because actual image size is too large and thumbnail of this too short so i want to fix the width & height of the image and want to sote this in a folder.

A: 

You might wanna use the function getimagesize.

It takes the filename as an argument and returns an array whose Index 0 and 1 contains respectively the width and the height of the image. Also Index 3 of the returned array is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.

codaddict
A: 

I can't really understand your exact needs but the easiest way to find out the dimensions of an image file is getimagesize():

<?php

list($width, $height, $type, $attr) = getimagesize('/home/foo/img/picture.jpg');
echo '<img src="img/picture.jpg" $attr alt="Picture">';

?>
Álvaro G. Vicario
I am using the image in front end but i dont want to show thumbnail.and i ca not show original image because its is too large so i want to pass the width and heght and crop ratio in src so image look as it same
Rohit
Are you referring to a rule of three?
Álvaro G. Vicario