Graphics function Library: getimagesize

Source: Internet
Author: User
Keywords getimagesize php Chinese function manual graphics function library
Tags aliyun array function function library graphics graphics function library html http

GetImageSize

(PHP3, PHP4)

GetImageSize---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Get the size of a GIF, JPEG, PNG, or SWF graphic

Syntax: array getimagesize (string filename [, array imageinfo])

Description:

GetImageSize () will determine the size of any GIF, JPG, PNG, or SWF document, and returns the width and height of the document and the type of file, with a high and wide string using an internal standard HTML IMG tag.

The returned array has four elements, the index value of 0 indicates the width of the graph to how many pixels (pixels), the index value 1 indicates the height of the graph, the index value 2 indicates the type of the graph, 1=gif,2=jpg,3=png, the index value 3 is a "height=xxx width=xxx" string , it can be used directly in the IMG tag.

Example:

<?php

<?php $size = getimagesize ("img/flag.jpg");?>

<img src= "img/flag.jpg" <?php echo $size [3];?>

?>

Non-required parameters Imageinfo allows you to take some extended information out of the map, which will now return different JPG app IDs (markers) in a combined array, some programs use these app logos to embed text information into graphics, a fairly common implant IPTC http://www.xe.net/iptc/information is in the APP13 identification. You can use the Iptcparse () function to parse the binary APP13 identity and become readable.

Example:

<?php

$size = getimagesize ("testimg.jpg",& $info);

if (Isset ($info [APP13])) {

$IPTC = Iptcparse ($info ["APP13"]); Var_dump ($IPTC);

}

?>

Note: This function does not require the GD graphics function library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.