Reputation: 4012
I want to do things on an image uploaded by the user.
Until now, what I do is:
move_uploaded_file
imagecreatefrompng
How can I manipulate it without saving it?
Upvotes: 1
Views: 155
Reputation: 101473
When the file is uploaded, it has to be stored somewhere in the server's /tmp/
folder. Simply load your image from there using $_FILES['name']['tmp_name']
.
For example:
$image = imagecreatefrompng($_FILES['blarg']['tmp_name']);
Will load the uploaded file (called blarg
) from it's temporary storage place under something like /tmp/php-12bja
. You don't need to call move_uploaded_file()
, and the image doesn't need to be saved to disk.
Upvotes: 1