Hi all. I try to run the following script that read image url from rss xml and display it but when image url has space on it, it fails as shown below(trows garbage as output with error).If i copy and paste that url the image displays in the browser but for some reason it trows error on the page if it is called with this php script. I be happy if some one help me deal with image names that has space on them.Thanks
Error:
php Code:
Error:
Code:
<br />
<b>Warning</b>: imagecreatefromjpeg(./david bob.jpg): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in <b>/home/[URL unfurl="true"]www/script.php</b>[/URL] on line <b>27</b><br />
<br />
<b>Warning</b>: imagecopymerge(): supplied argument is not a valid Image resource in <b>/home/[URL unfurl="true"]www/script.php</b>[/URL] on line <b>28</b><br />
‰PNG
IHDR¯ÝBµè IDATxœí½y|]Wu?ú]ç^I–5Y²[Ö`Yž;sâ8Î $!!$…_)Bûƒ/)Ð?÷h?@[Út miûƒþZÚ$Jµ?N!vl2cÏ“dk´5[–¬ùžõþØgï³öÞçÊr—÷~ZäsÏÙ
......
.....
Code:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Content-type: image/png");
$background = imagecreatefrompng("./backround_image.png");
$xml = file_get_contents("./rss.php?xml=true");
preg_match_all('/<(artist|song|image)>([^<]+)<\/\\1>/i', $xml, $matches);
list($artist, $song, $imageurl) = $matches[2];
//echo $artist;
//echo $song;
//echo $imageurl;
$insert = imagecreatefromjpeg($imageurl);
imagecopymerge($background,$insert,47,50,0,0,80,80,100);
......