PHP gets the image width, height, size, image type, and img attribute used for layout

不言
Release: 2023-03-25 06:30:01
Original
3952 people have browsed it

The content of this article is about PHP obtaining the image width, height, size, image type, and img attributes used for layout. It has a certain reference value. Now I share it with you. Friends in need can refer to it

//php自带函数 getimagesize()
$img_info = getimagesize('tomener.jpg');
echo &#39;<pre class="brush:php;toolbar:false">&#39;;
print_r($img_info);
输出:
Array 
( 
[0] => 170
[1] => 254
[2] => 2
[3] => width="170" height="254"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
这次要用到的就是第四个元素了
Copy after login

Related recommendations:

PHP method to get last week, this week, last month, this month, this quarter, and last quarter time

The above is the detailed content of PHP gets the image width, height, size, image type, and img attribute used for layout. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template