如何cURL图像类型的投影图像?
How to cURL image-type projected image?
我有这个问题。
有一个 Joomla 站点有一个通过 PHP 文件 image.php 呈现的图像,其中有一些内容类型要投影为图像。
我想用 cURL 或 file_get_contents 获取该图像并将其保存为 .jpg 文件。
它有 image.php 脚本将通过 GET 参数传递的图像投影为内容类型图像。
我已经尝试过标准 file_get_contents() 方法以及本主题中描述的所有 cURL 方法:Saving image from PHP URL
寻找答案。
尝试使用 file_put_contents() 函数
//Get the file
$content = file_get_contents("http://www.google.co.in/intl/en_com/images/srpr/logo1w.png");
//Store in the filesystem.
$fp = fopen("/location/to/save/image.png", "w");
fwrite($fp, $content);
fclose($fp);
来自
PHP - Copy image to my server direct from URL
解法:
$imgReplaced = str_replace('&', '&', $imgReplaced);
我有这个问题。
有一个 Joomla 站点有一个通过 PHP 文件 image.php 呈现的图像,其中有一些内容类型要投影为图像。
我想用 cURL 或 file_get_contents 获取该图像并将其保存为 .jpg 文件。
它有 image.php 脚本将通过 GET 参数传递的图像投影为内容类型图像。
我已经尝试过标准 file_get_contents() 方法以及本主题中描述的所有 cURL 方法:Saving image from PHP URL
寻找答案。
尝试使用 file_put_contents() 函数
//Get the file
$content = file_get_contents("http://www.google.co.in/intl/en_com/images/srpr/logo1w.png");
//Store in the filesystem.
$fp = fopen("/location/to/save/image.png", "w");
fwrite($fp, $content);
fclose($fp);
来自 PHP - Copy image to my server direct from URL
解法:
$imgReplaced = str_replace('&', '&', $imgReplaced);