doukundong9652 2010-02-03 08:33
浏览 67
已采纳

imagecreatefromstring函数的问题

I am trying to convert a string to an image using the "imagecreatefromstring" function (I've attached the code below). It works for most images, but when I try to convert larger images, a small portion of the image does not get converted (the lower part of the image is just grey)

my code is (take it from php.net example) :

            $data = base64_decode($record['text']);

            $im = imagecreatefromstring($data);
            if ($im !== false) {
                header('Content-Type: image/jpeg');
                imagejpeg($im);
                imagedestroy($im);
            }

i also try different way to decode the string not in one pice , but splitting the string and then decode it.

 for($i=0, $len=strlen($record['text']); $i<$len; $i+=4){
                $data.= base64_decode( substr($record['text'], $i, 4) );
            }
  • 写回答

2条回答 默认 最新

  • duanhua5523 2010-02-03 09:06
    关注

    It sounds like your data has been truncated, either on storage or on retrieval. Verify that you have the entire image in your store.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题