15

I used function imagecopyresampled to cropping image.

I tried use file_put_contents and fwrite to write the resized_image to file on hard disk but all attempts were failed.

Can I write the resized image to disk instead of using imagejpg to print it out to browser?

1

1 Answer 1

22

Here's the function signature for imagejpeg():

bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )

So, provide your destination filename as the second argument. (Standard filesystem permission warnings apply, make sure the process has write access to that directory.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.