dplht39359 2013-05-04 20:44
浏览 18
已采纳

图像是否仅针对浏览器裁剪?

I cropped an image using PHP GD imagecopyresampled() function. I used the function in the past, but now it seems that somehow, for browsers like Firefox & Chrome (latest versions of both) the image is not really cropped, but somehow transparent in the part that should be removed.

enter image description here

The OSX finder and Photoshop shows correct image sizes and no transparency...

What could be wrong?

This is the code for jpg images...

        if(!($sourceImage = @imagecreatefromjpeg($source)))
        {
            $image = imagecreate($width, $height);
            $colorWhite = imagecolorallocate($image, 255, 255, 255);
            $colorBlack = imagecolorallocate($image, 0, 0, 0);
            imagefill($image, 0, 0, $colorWhite);
            imagestring($image, 1, 1, 10, "Immagine non disponibile", $colorBlack);
            imagejpeg($image, $destination);
            return(FALSE);
        }

        $destinationImage = imagecreatetruecolor($width, $height);

        imagecopyresampled($destinationImage, $sourceImage,0,0,$x,$y,$width,$height,$width,$height);
        imagejpeg($destinationImage, $destination);

enter image description here

  • 写回答

1条回答 默认 最新

  • duanmeng3126 2013-05-04 23:38
    关注

    The problem was related to VirtualBox & Apache behaviour on guests OS.

    I solved with this change into the Apache2 Configuration.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度