From bf592ba144f0b83242edfb48c5c5201e2fbb86b2 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 25 Jun 2002 21:29:20 +0000 Subject: [PATCH] changes for getimagesize and new function #Q: how do i add the new function-file? git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@86734 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/image/functions/getimagesize.xml | 68 +++++++++++++++---- .../functions/image_type_to_mime_type.xml | 64 +++++++++++++++++ 2 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 reference/image/functions/image_type_to_mime_type.xml diff --git a/reference/image/functions/getimagesize.xml b/reference/image/functions/getimagesize.xml index 6ac4719eb5..4bba06460a 100644 --- a/reference/image/functions/getimagesize.xml +++ b/reference/image/functions/getimagesize.xml @@ -1,5 +1,5 @@ - + @@ -16,22 +16,24 @@ The getimagesize function will determine the size of any GIF, JPG, - PNG, SWF, - PSD, TIFF, - or BMP image file and - return the dimensions along with the file type and a height/width - text string to be used inside a normal HTML - IMG tag. + PNG, SWF, + SWC, PSD, + TIFF, BMP or + IFF + image file and return the dimensions along with the file type and + a height/width text string to be used inside a normal + HTML IMG tag. Returns an array with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 a flag indicating the type of the image. 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. - Index 3 is a text string with the correct - height="yyy" width="xxx" string that can be used directly in an IMG - tag. + 8 = TIFF(motorola byte order, 9 = JPC, 10 = JP2, 11 = JPX, 12 = + JB2, 13 = SWC, 14 = IFF. These values correspond to the IMAGETYPE + constants taht were added in PHP 4.3. Index 3 is a text string with + the correct height="yyy" width="xxx" string that can be used + directly in an IMG tag. getimagesize (file) @@ -55,11 +57,46 @@ echo ""; - With JPG images, two extras index are returned: - channel and bits. - channel will be 3 for RGB pictures, and 4 for CMYK + With JPG images, two extras index are returned : + channels and bits. + channels will be 3 for RGB pictures, and 4 for CMYK pictures. bits is the number of bits for each color. + + Since PHP 4.3 bits and channels + are present for other image types, too. But these values or there + presence can be a bit confusing. As example GIF + allways uses 3 channels per pixel but the number of bits per pixel + cannot be computed for an animated GIF with a global + colortable. + + + Some formats may contain no image or multiple images. In such cases + GetImageSize might not be able to determine the size and returns zero + for width and height. + + + Since PHP 4.3 GetImageSize() does also return the additional + mime that receives the mime-type ot the image. + This information can be used to deliver images with correct http + Content-type header if this is unknown: + + getimagesize and mime-type + + +]]> + + + If accessing the filename image is impossible, or if it isn't a valid picture, getimagesize @@ -99,7 +136,8 @@ if (isset ($info["APP13"])) { This function does not require the GD image library. - See also exif_imagetype, exif_read_data + See also image_type_to_mime_type, + exif_imagetype, exif_read_data and exif_thumbnail. diff --git a/reference/image/functions/image_type_to_mime_type.xml b/reference/image/functions/image_type_to_mime_type.xml new file mode 100644 index 0000000000..c1f338f0d8 --- /dev/null +++ b/reference/image/functions/image_type_to_mime_type.xml @@ -0,0 +1,64 @@ + + + + + + image_type_to_mime_type + Get Mime-Type for image-type returned by getimagesize, + exif_read_data, exif_thumbnail, exif_imagetype + + + Description + + string image_type_to_mime_type + intimagetype + + + The image_type_to_mime_type function will determine + the Mime-Type for an IMAGETYPE constant. + + image_type_to_mime_type (file) + + +]]> + + + + + + + This function does not require the GD image library. + + + See also getimagesize, + exif_imagetype, exif_read_data + and exif_thumbnail. + + + + + + +