2013-10-30 4 views
0

업로드 된 이미지에 워터 마크를 추가하려고합니다. '이미지 워터 마크가 작동하지 않습니다.

Warning: imagecreatefromjpeg(upload/##.jpg): failed to open stream: No such file or directory in

나는 몇 가지 변화 php.net에서 코드를 사용하고 있습니다 :

// Load the stamp and the photo to apply the watermark to 
$stamp = imagecreatefrompng('logo.png'); 
$im = imagecreatefromjpeg($image); 

// Set the margins for the stamp and get the height/width of the stamp image 
$marge_right = 10; 
$marge_bottom = 10; 
$sx = imagesx($stamp); 
$sy = imagesy($stamp); 

// Copy the stamp image onto our photo using the margin offsets and the photo 
// width to calculate positioning of the stamp. 
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp)); 

// Output and free memory 
header('Content-type: image/png'); 
imagepng($im); 
imagedestroy($im); 
?> 
+0

로고가 저장되는 위치를 확인하십시오. file이있는 디렉토리와 같은 디렉토리에 있어야합니다. –

답변

0

나는 Y를 느낀다 ou가 이미지 $im = imagecreatefromjpeg($image);의 잘못된 경로를 전달하고 있습니다. $ image의 값을 확인하고 테스트 목적으로 두 이미지를 같은 디렉토리에 복사하고 스크립트를 실행하십시오.

관련 문제