nuvel
Watermark на изображении отображается в плохом качестве. Не могу понять, что не так в коде:
PHP:
//добавляем на изображение watermark function watermarkImage($imgPath) { $edgePadding=0; $quality=100; $original=$imgPath; $target=$imgPath; $watermark=DIR_ROOT.‘img/watermark.png’; $wmTarget=DIR_FILES_USER.‘watermark.tmp’; $origWidth = $origInfo[0]; $origHeight = $origInfo[1]; $waterMarkWidth = $waterMarkInfo[0]; $waterMarkHeight = $waterMarkInfo[1]; // watermark sizing info // OK, we have what size we want the watermark to be, time to scale the watermark image resize_png_image($watermark,$waterMarkDestWidth,$waterMarkDestHeight,$wmTarget); // get the size info for this watermark. $waterMarkDestWidth=$wmInfo[0]; $waterMarkDestHeight=$wmInfo[1]; $differenceX = $origWidth — $waterMarkDestWidth; $differenceY = $origHeight — $waterMarkDestHeight; // where to place the watermark? $finalWaterMarkImage, $placementX, $placementY, 0, 0, $finalWaterMarkWidth, $finalWaterMarkHeight ); return true; } //изменение размеров watermark function resize_png_image($img,$newWidth,$newHeight,$target){ if($srcImage==»){ return FALSE; } $percentage=(double)$newWidth/$srcWidth; if($destHeight > $newHeight){ // if the width produces a height bigger than we want, calculate based on height $percentage=(double)$newHeight/$srcHeight; } return FALSE; } return FALSE; } return FALSE; } return FALSE; } return TRUE; }