PHP:来自不同服务器的imagecreatefromstring

时间:2013-06-10 16:15:40

标签: php gd

好的,我无数次地看了这个。很多人说为了使用imagecreatefrompng('某种photobucket url或imgur.com'),你需要做这个功能:

$powered = imagecreatefromstring(file_get_contents('http://bowlinggreen.halfoffdeals.com/images/small_logos/bowlinggreen.png'));
$powered = imagepng($powered_by);

然而,这对我没有帮助。它给了我这个错误:

  

警告:imagecreatefromstring()[function.imagecreatefromstring]:   空字符串或无效图像   第123行/usr/home/dev1/public_html/inline/iframe_special_gd.php

     

警告:imagepng():提供的参数不是有效的Image资源   第124行/usr/home/dev1/public_html/inline/iframe_special_gd.php

     

警告:imagecopymerge():提供的参数不是第129行/usr/home/dev1/public_html/inline/iframe_special_gd.php中的有效图像资源

我正在尝试将此网址作为图片合并到当前图片的顶部:

$image = imagecreatefrompng('http://dev1.mogadore-deals2.com/images/gdprac/blank_template2.png');

imagecopymerge($powered, $image, 5, 10, 5, 10, 150, 148, 100);

    imagefttext($image, 8, 0, 163, 20, $color, '../images/gdprac/LUCIDASANSSTD-BOLD.OTF', 'Your Price:');
    imagefttext($image, 22, 0, 163, 48, $color, '../images/gdprac/LUCIDASANSSTD.OTF', '$'.$selling_price);
    imagefttext($image, 7, 0, 168, 70, $color, '../images/gdprac/LUCIDASANSSTD.OTF', 'Original Price');
    imagefttext($image, 11, 0, 182, 90, $color, '../images/gdprac/LUCIDASANSSTD.OTF', '$'.$certificate_value);
    imagefttext($image, 7, 0, 248, 70, $color, '../images/gdprac/LUCIDASANSSTD.OTF', 'Savings');
    imagefttext($image, 11, 0, 250, 90, $color, '../images/gdprac/LUCIDASANSSTD.OTF', '50%');
    imagefttext($image, 7, 0, 163, 153, $color, '../images/gdprac/LUCIDASANSSTD.OTF', 'Powered by:');

imagepng($image, '../images/gdprac/final_temp.png');

0 个答案:

没有答案