Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn about the PHP function getimagesize to obtain the width and height of the picture.
Array getimagesize (string $ filename [, array & $ imageinfo])
Returns an array with four units. Index 0 contains the pixel value of the image width, and index 1 contains the pixel value of the Image Height. Index 2 is the mark of the image type: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF (intel byte order), 8 = TIFF (motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These tags correspond to the newly added IMAGETYPE constant in PHP 4.3.0. Index 3 is a text string with the content "height =" yyy "width =" xxx "and can be directly used for IMG marking.
This is the PHP official site manual: http://php.net/manual/en/function.get...
Add a demo:
$ Images_array = array ("http://static.zend.com/img/logo.gif ");
Foreach ($ images_array as $ image)
{
List ($ width, $ height, $ type, $ attr) = getimagesize ($ image );
$ New_height = (int) (192/$ width * $ height );
Echo'
';
}
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB