tags:

views:

18

answers:

1

Hi there, I don't know how to do this and I was wondering if someone smart could give me an example :)

I want someone to be able to post a png,jpg, or bmp image url and then id use PHP GD to duplicate the image including width and height.

Could someone give me an example of this? Also id like it to support only png, jpeg, and bmp.

A: 

I would, in the script, download the URL first (check out PHP cURL), and then attempt to read in the file using GD.

http://php.net/manual/en/book.curl.php

http://php.net/manual/en/book.image.php

You can do a simple regex (something like /^.*\.(jpg|jpeg|png|gif)$/i) on the URL, but URLs don't always represent the type of file you get. Depending on what you need, it might be better to download first and ask questions later.

erjiang