2016-11-11 296 views
-1

使用PHP可以在存储AWS S3 Bucket的图像上应用水印吗?使用PHP为AWS S3存储桶中包含的图像添加水印?

如果图像存在与否以及应用了水印后,我尝试使用以下检索。

$galleryImg = '_1473241284.jpg'; 
    // echo $galleryImg; 
    test(file_exists('https://s3-ap-southeast-1.amazonaws.com/bucketname/test123/'.$galleryImg)); 

    //for direct apply watermark on server 
    if(file_exists('https://s3-ap-southeast-1.amazonaws.com/bucketname/test123/'.$galleryImg)){ 
    // test("hiii"); 
    // echo "hii"; 
    $watermark->apply('https://s3-ap-southeast-1.amazonaws.com/bucketname/test123/'.$galleryImg, 'https://s3-ap-southeast-1.amazonaws.com/bucketname/test123/'.$galleryImg, $watermarkImg, 3); 

    $response1 = $client->putObject(array('Bucket' => BUCKETNAME, 'Key' => 'bucketname/test123/'.$galleryImg, 'SourceFile' => 'https://s3-ap-southeast-1.amazonaws.com/bucketname/test123/'.$galleryImg, 'ACL' => 'public-read')); 
    //echo "watermark applied"; 
    } 

回答

2

而不是应用水印和保存图像返回到Amazon S3,您可以使用第三方服务来应用水印上即时

+0

我们可以使用像imgix这样的服务通过相应地发送URL参数来动态应用水印。鉴于我不想暴露无水印的图像,使用上述解决方案查询参数可以修剪,它可以让我们获得原始图像。有没有办法避免它? – apoorvam

+0

@apoorvam这是一个古老的问题。请创建一个新问题,而不是在评论部分询问新话题。 –