Hướng dẫn get image properties php
(PHP 4, PHP 5, PHP 7, PHP 8) getimagesize — Get the size of an image Descriptiongetimagesize(string
getimagesize() can also return some more information in Caution This function expects Do not use getimagesize() to check that a given file is a valid image. Use a purpose-built solution such as the Fileinfo extension instead.
Parametersfilename This parameter specifies the file you wish to retrieve information about. It can reference a local file or (configuration permitting) a remote file using one of the supported streams. image_info This optional parameter allows you to extract some extended information from the image file. Currently, this will return the different JPG APP markers as an associative array. Some programs use these APP markers to embed text information in images. A very common one is to embed » IPTC information in the APP13 marker. You can use the iptcparse() function to parse the binary APP13 marker into something readable.
Return Values Returns an array with up to 7 elements. Not all image types will include the Index 0 and 1 contains respectively the width and the height of the image.
Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image. Index 3 is a text string with the correct Example #1 getimagesize() and MIME types
For some image types, the
presence of On failure, Errors/Exceptions If accessing the Changelog
ExamplesExample #2 getimagesize() example
Example #3 getimagesize (URL)
Example #4 getimagesize() returning IPTC
Notes
See Also
james dot relyea at zifiniti dot com ¶ 13 years ago
nikolam3244 at gmail dot com ¶ 4 years ago
feof( $handle ) ) { tomasz at trejderowski dot pl ¶ 9 years ago
php dot net at dannysauer dot com ¶ 17 years ago
info at personalmis dot com ¶ 14 years ago
geoff at spacevs dot com ¶ 12 years ago
1) { alexyam at live dot com ¶ 10 years ago
class blob_data_as_file_stream { kazuya ¶ 8 years ago
= img_resize("./img/", "test.jpg","copy_test.jpg",300); shmohel at gmail dot com ¶ 14 years ago
redcore at gmail dot com ¶ 15 years ago
= $_FILES['userfile']['tmp_name']; cloned at clonedmadman dot com ¶ 14 years ago
info at alex-lawrence dot com ¶ 14 years ago
utilmind ¶ 11 years ago
Jesus Zamora ¶ 11 years ago
ajreading at classixshop dot com ¶ 17 years ago
$width <= $max_width) && ($height <= $max_height) ) freecorvette at gmail dot com ¶ 4 years ago
Coodiss at w3bbix dot net ¶ 17 years ago diablx at hotmail dot com ¶ 18 years ago anonymous ¶ 13 years ago user
at example dot net ¶ 14 years ago mail at soylentgreens dot com ¶ 17
years ago pfarthing at hotmail dot com ¶ 14 years ago |