Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,487 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,697 people online right now. Registration is fast and FREE... Join Now!




How to download images from a remote server using PHP code

 
Reply to this topicStart new topic

How to download images from a remote server using PHP code

kotaro_fs
25 Feb, 2008 - 07:51 PM
Post #1

New D.I.C Head
*

Joined: 25 Feb, 2008
Posts: 1

Dear all!

I'm a newb in PHP programming language, and I do not know how to download images from a remove server to my server.

In my case, I have to calculate the total size of some images from a remote server. So, I think that firstly I have to download these images to my server and use filesize($imagePath) to calculate the size of them. Cause the filesize() function does not work with $imagePath = url (local path only ???)

Please help me ! smile.gif

Regards,
kotaro
User is offlineProfile CardPM
+Quote Post

ap0c0lyps3
RE: How To Download Images From A Remote Server Using PHP Code
26 Feb, 2008 - 06:39 AM
Post #2

D.I.C Head
Group Icon

Joined: 19 Jun, 2007
Posts: 79


Dream Kudos: 25
My Contributions
You don't have to download the image. All you have to do is do a HEAD http request and in the header their should be a content-length (or something like that) that will give the file size.
User is offlineProfile CardPM
+Quote Post

SpaceMan
RE: How To Download Images From A Remote Server Using PHP Code
26 Feb, 2008 - 07:08 AM
Post #3

D.I.C Regular
Group Icon

Joined: 20 Feb, 2003
Posts: 270

look up copy function, on php.net.

This post has been edited by SpaceMan: 26 Feb, 2008 - 07:14 AM
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: How To Download Images From A Remote Server Using PHP Code
26 Feb, 2008 - 06:28 PM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,465



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(SpaceMan @ 26 Feb, 2008 - 08:08 AM) *

look up copy function, on php.net.

or Curl
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 07:30PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month