PHP合并来自外部URL的图像

时间:2013-10-17 10:39:42

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

我试图在Amazon s3上合并一堆.png图像存储,并在托管该网站的本地服务器上存在这些文件。这些代码可以很好地处理本地服务器上的文件,但不能与外部文件一起使用。

这是代码:

for ($i = 1; $i < $count_images; ++$i) {
    $insert = $res['images'][$i]['src'];
    if (file_exists($insert)) {
        $photo2       = imagecreatefromstring(file_get_contents($insert));
        $foto2W       = imagesx($photo2);
        $foto2H       = imagesy($photo2);
        $photoFrame2  = imagecreatetruecolor($foto2W, $foto2H);
        $trans_colour = imagecolorallocatealpha($photoFrame2, 0, 0, 0, 127);
        imagefill($photoFrame2, 0, 0, $trans_colour);
        imagecopyresampled($photoFrame2, $photo2, 0, 0, 0, 0, 260, 260, $foto2W, $foto2H);
        imagecopy($photoFrame, $photoFrame2, 130, 0, 0, 0, 260, 260);
    }
}

图像URL以json的形式发送,json被解码并计数并在彼此之上分层。我能够回复来自$insert的网址,并且在尝试将它们作为单独的图像打开时,它会起作用。

我是否对代码做错了,或者我是否有任何与亚马逊s3有关的工作?

0 个答案:

没有答案
相关问题