2015-01-01 3 views
0

현재 이미지를 업로드 할 수있는 페이지를 만들고 있습니다. 내가 알아야 할 것은 이미지를 업로드 할 때 추가 된 텍스트 워터 마크입니다. 텍스트를 삽입 할 수 있어야합니다. 워터 마크에 표시됩니다.텍스트 워터 마크가있는 PHP

은 내 PHP

$location = '/usr/local/apache/htdocs/images/'.$_FILES['file']['name']; 

       if (is_uploaded_file($_FILES['file']['tmp_name'])) { 
        if (!move_uploaded_file($_FILES['file']['tmp_name'], $location)) { 
         echo 'you cant copy your file'; 
         exit; 
        } else { 
         echo 'you uploaded correctly<br><br>'; 
         exit; 
        } 
       exit; 
       } 

나는 잠시 동안 보았다

 <input type="file" name="file" /><br /> 
     <input type="submit" value="Send" /> <br/> 
     </form> 

그게 전부 HTML,하지만 난 제대로

+0

체크 아웃 ['imagettftext'에 대한 PHP 매뉴얼] (http://php.net/manual/en/를 function.imagettftext.php)뿐만 아니라 [이 답변은 이미지에 텍스트를 쓰는 코드를 자세히 설명합니다] (http://stackoverflow.com/questions/13267846/how-to-add-text-to-an-image-with- php-gd-library). 그렇게 간단한 것이 아니라면, [GD 기능을 포함하는 오래된 클래스 집합] (https://github.com/rockerest/nox/tree/master/classes/backbone)을 작성했습니다 (관련 클래스가 시작됩니다. 내 이미지는 잘 설명되어 있지 않습니다. – rockerest

+0

http://php.net/manual/en/image.examples.merged-watermark.php 메신저를 사용하려고했으나 어떻게 변경해야하는지 궁금합니다. 이 라인 '$ im = imagecreatefromjpeg ('photo.jpeg ');' photo.jpeg 내가 업로드 한 파일입니다. – pkk

답변

1

을 이해할 수있는 튜토리얼을 찾을 수 없습니다 나는 당신이 다음에 사용할 수있는 'Imagick'확장자를 사용하도록 권합니다.

<?php 
// Open the original image 
$image = new Imagick(); 
$image->readImage("/path/to/image.jpg"); 

// Open the watermark 
$watermark = new Imagick(); 
$watermark->readImage("/path/to/watermark.png"); 

// Overlay the watermark on the original image 
$image->compositeImage($watermark, imagick::COMPOSITE_OVER, 0, 0); 

// send the result to the browser 
header("Content-Type: image/" . $image->getImageFormat()); 
echo $image; 
0

이 시도 :

텍스트 워터 마크를 PHP에

$imagetobewatermark=imagecreatefrompng("images/muggu.png"); 
$font="../font/century gothic.ttf"; 
$fontsize="15"; 
$watermarktext="Muggu"; // text to be printed on image 
$white = imagecolorallocate($imagetobewatermark, 255, 255, 255); 
imagettftext($imagetobewatermark, $fontsize, 0, 20, 10, $white, $font, $watermarktext); 
header("Content-type:image/png"); 
imagepng($imagetobewatermark); 
imagedestroy($imagetobewatermark); 
관련 문제