开发者

PHP GD Duplicate image from Different server

开发者 https://www.devze.com 2023-01-08 01:33 出处:网络
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 ur开发者_高级运维l and then id use PHP GD to du

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 ur开发者_高级运维l 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消