PHP GD Library and uploaded files -


i'm working on project upload image (jpg) , manipulate using php gd library.

i know can use gd functions edit image resource (created imagecreatefromjpeg()) wondering if there way use file uploaded in $_files array directly gd library. 1 solution thought of saving uploaded file, pushing imagecreatefromjpeg, deleting afterwards.

this seems cluinky though, there more efficient solution?

i'm still bit new php i'm not sure how files stored in $_files array. hope i'm making sense here. thanks.

you can this:

$img = imagecreatefromjpeg($_files['image']['tmp_name']); // gd operations on $img imagejpeg($img, '/path/to/target'); 

you'll have use imagecreatefrom in form or another, , can use directly on uploaded file. save result of manipulations using imagejpeg. uploaded file in tmp_name thrown away automatically.

having said that, should save original somewhere. it's have around later use.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -