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
2010-03-03 11:28:42
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
2010-03-03 11:30:27
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
2010-03-03 13:06:32
Are you referring to a rule of three?
Álvaro G. Vicario
2010-03-03 15:42:19