简体   繁体   English

使用PHP将水印添加到AWS S3存储桶中的图像中吗?

[英]Add watermark to image contains in AWS S3 bucket using PHP?

Is it possible apply watermark on image stored AWS S3 Bucket using PHP? 可以使用PHP在图像存储的AWS S3存储桶上应用水印吗?

I have tried with following for retrieve if image exist or not and after watermark applied. 我尝试使用以下方法检索是否存在图像以及应用水印后。

    $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";
    }

Rather than applying a watermark and saving the image back to Amazon S3, you could use a third-party service to apply the watermark on-the-fly : 您可以使用第三方服务来即时应用水印,而不是应用水印并将图像保存回Amazon S3:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM