PHP中的自动图像格式检测 [英] Automatic image format detection in PHP

查看:165
本文介绍了PHP中的自动图像格式检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来获取用户上传的图像,该图像目前放置在一个临时位置,如:/ tmp / jkhjkh78,并从中创建一个php图像,自动检测格式。



有没有更聪明的方法来做这个比试图抓取imagefromjpeg,imagefrompng等? 解决方案

这是 getimagesize 的功能之一。他们可能应该把它叫做getimageinfo,但这是你的PHP。


I am looking for a way to take a user uploaded image that is currently put in a temporary location ex: /tmp/jkhjkh78 and create a php image from it, autodetecting the format.

Is there a more clever way to do this than a bunch of try/catching with imagefromjpeg, imagefrompng, etc?

解决方案

This is one of the functions of getimagesize. They probably should have called it "getimageinfo", but that's PHP for you.

这篇关于PHP中的自动图像格式检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆