2012-01-11 112 views
0

我遇到了一个问题,在我的cakePHP应用程序中使用jQuery Uploadify插件。Uploadify:图像透明度变黑

这一切运作良好除了一个问题,我收到的时候我上传图片的透明度。每当我上传带有透明度的图片时,图片的透明区域都会保存为黑色。

我怀疑这可能由Uploadify插件无法正常加载图像的Alpha通道造成的,但我不能肯定。

+0

hm我想我必须更改uploadify插件的核心代码。 感谢您的回复.. 干杯... – 2012-01-11 10:34:13

+0

您能详细说明您是如何做到的,以及它是否实际上是插件中的错误,或者它是否是您忽略的错误? – casperOne 2012-01-11 15:41:28

回答

0

感谢您的贡献。

我已经解决了我必须改变,我使用上传图像的图像组件的大小调整功能里面的代码位的问题。

我以前把一些代码:

imagecopyresampled($imgDes, $imgSrc, 0, 0, 0, 0, $width, $height, $trueWidth, $trueHeight);

和新的代码如下:

 if($fileType == 'png' || $fileType == 'gif') { 
     imagealphablending($imgDes, false); 
     imagesavealpha($imgDes,true); 
     $transparent = imagecolorallocatealpha($imgDes, 255, 255, 255, 127); 
     imagefilledrectangle($imgDes, 0, 0, $width, $height, $transparent); 
    } 

将这个新的代码图像组件以下功能:

function resizeImg($imgName, $size, $fileName)