当前位置:网站首页>PHP method of obtaining image information
PHP method of obtaining image information
2022-07-07 22:30:00 【Game programming】
Want to pass php Gets the width and height of the image , Here are two ways , As a reference .
Method 1 :
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)');$thumb_url="https://dss0.bdstatic.com/-0U0bXSm1A5BphGlnYG/tam-ogel/2dbeac414fc1ee690d00c764c89a187e_121_121.png";$imageInfo=getimagesize($thumb_url);print_r($imageInfo);The result is :

Method 2 :
$refer="https://dss0.bdstatic.com";$option=array('http'=>array('header'=>"Referer: {$refer}"));$context=stream_context_create($option);// Create a resource flow context $thumb_url="https://dss0.bdstatic.com/-0U0bXSm1A5BphGlnYG/tam-ogel/2dbeac414fc1ee690d00c764c89a187e_121_121.png";$file_contents = file_get_contents($thumb_url,false, $context);// Read the entire file into a string $thumb_size = getimagesizefromstring($file_contents);// Get image size information from string print_r($thumb_size);The result is :

Both methods can obtain the information of pictures , You can choose which one to use .
author :salestina
Game programming , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
边栏推荐
- Revit secondary development - get the thickness / length / height of the beam
- [open source] Net ORM accessing Firebird database
- Use partial derivatives to display normals in unity
- Revit secondary development - collision detection
- How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
- OpenGL homework - Hello, triangle
- PKPM 2020软件安装包下载及安装教程
- Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
- 戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
- Revit secondary development - operation family documents
猜你喜欢

用语雀写文章了,功能真心强大!

Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission

如何选择合适的自动化测试工具?

三元表达式、各生成式、匿名函数

How to judge whether the input content is "number"

Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold

Matplotlib快速入门

How does win11 unblock the keyboard? Method of unlocking keyboard in win11

Record a garbled code during servlet learning

Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
随机推荐
Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
Overseas agent recommendation
100million single men and women "online dating", supporting 13billion IPOs
23. Merge K ascending linked lists -c language
npm uninstall和rm直接删除的区别
Reinforcement learning - learning notes 9 | multi step TD target
Cataloger integrates lidar and IMU for 2D mapping
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
[environment] pycharm sets the tool to convert QRC into py file
Get the week start time and week end time of the current date
[open source] Net ORM accessing Firebird database
Record a garbled code during servlet learning
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
Remember aximp once Use of exe tool
Robot autonomous exploration DSVP: code parsing
The latest Android interview collection, Android video extraction audio
Form组件常用校验规则-2(持续更新中~)
Use partial derivatives to display normals in unity
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Record problems fgui tween animation will be inexplicably killed