很简单上传服务器,从临时文件,'tmp_name'得到图片,
然后压缩。$dstimage  = imagecreatetruecolor($dst_w, $dst_h);
imagecopyresampled($dstimage,$srcimage,$dst_x, $dst_y , $src_x,$src_y ,$dst_w, $dst_h, $src_w,$src_h);
imagedestroy($srcimage);查找了好久都没有找到如何,保存内存中的图片 $dstimage 的方法?

解决方案 »

  1.   

    /** 打开输出缓冲 **/
    ob_start();/** 输出图像 **/
    imagepng($dstimage);/** 获取缓冲区内容 **/
    $img = ob_get_contents();/** 清空输出缓冲 **/
    ob_end_clean();/** 然后把$img保存到文件就行了 **/
      

  2.   

    没看懂,能具体点吗? 
    我就这个 $dstimage 
    最好保存怎么弄?
      

  3.   

    // 保存的位置
    $file = "/image/hello.png"
    imagepng($dstimage, $file); 说明bool imagepng ( resource $image [, string $filename ] )
    imagepng() 将 GD 图像流(image)以 PNG 格式输出到标准输出(通常为浏览器),或者如果用 filename 给出了文件名则将其输出到该文件。
      

  4.   

    搞定了。 不过BMP好像GD库木有办法啊。