-
call php function in image url download
Hey well i need help i want to create a simple image downloading script
where you insert the image URL and it will download it and place it on
the server, Any one have any ideas on how i can do this?
eg...

http://www.weberdev.com/UserPictures/NoImage.jpg
thanks
-
-
If your PHP setup is configured to allow remote files, this should work for you:
<?php
$i = file_get_contents('http://...../image.jpg');
$f = fopen('path/my.jpg','w+');
fwrite($f,$i);
fclose($f);
?>
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
How call php function insert image url
I need to create a simple image downloading script where you insert the image URL and it will download or add it and place it on the server or in the database, Any one have any bright ideas on how i can do this?
eg:
The image of 39dollarglasses.com (http://www.39dollarglasses.com/store...164_Brown.jpg), in which i will insert it to my website using php script.. i really appreciate your help.. thanks in advance..
-
-
$i = file_get_contents($_GET['url']);
Then just make a form with a field "url" and that will be the url used in the script, or you could link to it like "thatpage.php?url=http://whatever".
You may want to use error checking, with
if (file_exists($_GET['url'])) first
etc.
As for adding to a database, etc., look here:
http://php-mysql-tutorial.com
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks