How to use PHP function getimagesize _php Tutorial

Source: Internet
Author: User

Defined

Get the length and width of the picture.

Grammar:

Array getimagesize (string filename, array [imageinfo]);

return value:

Array

Function Type:

Graphics processing

Content Description:

PHP function getimagesize can be used to obtain GIF, JPEG and PNG three kinds of www slices of high and wide, do not need to install the GD library to use this function. The returned array has four elements. The first element of the returned array (index value 0) is the height of the picture, in pixels (pixel).

The second element (index value 1) is the width of the picture. The third element (index value 2) is the file format of the picture, with a value of 1 in GIF format, 2 in jpeg/jpg format, and 3 in PNG format. The fourth element (index value 3) is the height and width of the picture string, Height=xxx width=yyy.

The omitted parameter imageinfo is used to obtain some information about the picture, such as the app13 mark of the IPTC (HTTP://WWW.XE.NET/IPTC), which can be added to the picture, and can be parsed using iptcparse ().

code example for PHP function getimagesize:

 
  
  
  1. < ? PHP
  2. function Myimg ($imgfile) {
  3. $ size getimagesize($imgfile);
  4. echo " < img src= "$imgfile" $size [3]>";
  5. }
  6. Myimg ("Img/img1.gif");
  7. Myimg ("Img/img2.png");
  8. ?>


http://www.bkjia.com/PHPjc/446063.html www.bkjia.com true http://www.bkjia.com/PHPjc/446063.html techarticle defines the length of the image to be obtained. Syntax: array getimagesize (string filename, array [imageinfo]); Return value: Array function type: Graphical processing content Description: PHP function getimagesize available ...

  • 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.