Hi all, For copying an image i use this function copyImg($url) { $file=file_get_contents($url); $local_name=basename($url); if ($file) { $handle=fopen('test/'.$local_name, 'a'); //writes to current directory (must be chmod'd to 777) if (fwrite($handle,$file) === false) { echo "Cannot write file"; } else { echo 'File successfully written. thanks!'; } fclose($handle); } else { echo '<a href="'.$url.'">'.$url.'</a> cannot be read'; } } PHP: but this doesn't work for watermark.php?folder=dat&width=300&article=663 How can i fix this??
what do you mean? Is watermark.php using GD to generate an image? If so, when you copy just save the file as a .gif or .jpg whatever it is creating the image as. Regards, Dennis M.
hi dennis, Indeed that is exactly what i meant. Somehow it doesn't save the watermark as an image i get an unexpected format/error. If i browse to watermark.php with the variables it does show a .jpg`. Any suggestions?
think i got it to work by adding ob_start(); include($url); $file = ob_get_contents(); ob_get_clean(); PHP:
hmm, i am now trying with a class i found. Which works very fine........except with function endElement($parser, $tagName) { if (($tagName == "ITEM") or ($tagName == "GENERAL")) { //here save the rss elements //but now for the image $image = new GetImage; // just an image URL for testing $image->source = 'http://img.dailymail.co.uk/i/pix/2007/12_01/17banksyES_468x606.jpg'; //give it a name base on merchant name $test = $merchantName.'-'.$this->id; $image->givenName = $test;//doesn't work //$image->givenName = "this-one-worked"; $image->save_to = 'testfolder/'; // with trailing slash at the end $image->quality = '75'; $get = $image->download('gd'); // using GD //here the other rss elements $this->id = ""; $this->title = ""; $this->description = ""; $this->img_large = ""; $this->link = ""; $this->insideitem = false; } } Code (markup): The code works when i hardcode the $givenName. But i like it to be a combo of merchant name + id. What happens is the extension isn't being saved. When i set $givenName = "testing"; It will save testing.jpg Do i need the "" for the class???