duanhe3393 2011-02-25 01:19
浏览 328
已采纳

PHP从file_get_contents获取图像尺寸(“php:// input”)

Due to the upload script I can not obtain the uploaded file by $_FILE variable, thefore I have to make do with

$file = file_get_contents("php://input")

I want to get the dimensions if it's an image, for that purpose, I would use getimageresize() but getimageresize() only take a file not a string. So that's my problem. How do i solve this?

  • 写回答

3条回答 默认 最新

  • dtxs9017 2011-02-25 01:23
    关注
    $image = imagecreatefromstring($img_str);
    $w = imagesx($image);
    $h = imagesy($image);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部