Quantcast
Channel: Saving image from PHP URL - Stack Overflow
Browsing latest articles
Browse All 12 View Live

Answer by Owen Far for Saving image from PHP URL

None of the answers here mention the fact that a URL image can be compressed (gzip), and none of them work in this case.There are two solutions that can get you around this:The first is to use the cURL...

View Article



Answer by sen for Saving image from PHP URL

$data = file_get_contents('http://example.com/image.php');$img = imagecreatefromstring($data);imagepng($img, 'test.png');

View Article

Answer by zloctb for Saving image from PHP URL

See file()PHP Manual:$url = 'http://mixednews.ru/wp-content/uploads/2011/10/0ed9320413f3ba172471860e77b15587.jpg';$img = 'miki.png';$file = file($url);$result = file_put_contents($img, $file)

View Article

Answer by Halil Özgür for Saving image from PHP URL

Use PHP's function copy():copy('http://example.com/image.php', 'local/folder/flower.jpg');Note: this requires allow_url_fopen

View Article

Answer by karl for Saving image from PHP URL

$img_file='http://www.somedomain.com/someimage.jpg'$img_file=file_get_contents($img_file);$file_loc=$_SERVER['DOCUMENT_ROOT'].'/some_dir/test.jpg';$file_handler=fopen($file_loc,'w');if(fwrite($file_han...

View Article


Answer by stoefln for Saving image from PHP URL

Vartec's answer with cURL didn't work for me. It did, with a slight improvement due to my specific problem.e.g.,When there is a redirect on the server (like when you are trying to save the facebook...

View Article

Answer by Ibrahim for Saving image from PHP URL

Create a folder named images located in the path you are planning to place the php script you are about to create. Make sure it has write rights for everybody or the scripts won't work ( it won't be...

View Article

Answer by Andrew for Saving image from PHP URL

I wasn't able to get any of the other solutions to work, but I was able to use wget:$tempDir = '/download/file/here';$finalDir = '/keep/file/here';$imageUrl =...

View Article


Answer by Sam Becker for Saving image from PHP URL

Here you go, the example saves the remote image to image.jpg.function save_image($inPath,$outPath){ //Download images from remote server $in= fopen($inPath, "rb"); $out= fopen($outPath, "wb"); while...

View Article


Answer by vartec for Saving image from PHP URL

If you have allow_url_fopen set to true:$url = 'http://example.com/image.php';$img = '/my/folder/flower.gif';file_put_contents($img, file_get_contents($url));Else use cURL:$ch =...

View Article

Answer by soulmerge for Saving image from PHP URL

$content = file_get_contents('http://example.com/image.php');file_put_contents('/my/folder/flower.jpg', $content);

View Article

Saving image from PHP URL

I need to save an image from a PHP URL to my PC.Let's say I have a page, http://example.com/image.php, holding a single "flower" image, nothing else. How can I save this image from the URL with a new...

View Article
Browsing latest articles
Browse All 12 View Live




Latest Images