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

时间:2016-11-11 10:16:24

标签: php amazon-web-services amazon-s3 aws-sdk

是否可以使用PHP在存储的AWS S3 Bucket图像上应用水印?

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

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

1 个答案:

答案 0 :(得分:2)

您可以使用第三方服务即时应用水印,而不是应用水印并将图像保存回Amazon S3。