I am working on a script that uploads a picture using PHP and I wanna make it resize the image to width 180 before saving it.
I tried using the WideImage library and ->saveFileTO(...) but when I include the WideImage.php in the page, the page goes blank !!
So here is my script if you can help me and tell me how to make it save the resized version
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You can use a class I've written for just such a task:
http://code.google.com/p/image2/source/browse/#svn/trunk/includes/classes
Dont use any library Check this script http://dr-wordpress.blogspot.com/2013/12/image-resizing-using-php.html Just gave the quality of imges from (0-99) this code will automatically resize the images while uploading
You can use the PHP GD library to resize an image on upload.
The following code should give you an idea of how to implement the resize:
You don't even need to use the WideImage library.
Check this script here: http://bgallz.org/502/php-upload-resize-image/
You start by uploading the image and saving to a temp image file. This script runs off a form with inputs for the max height or max width. So it will then generate a new image file based on the new width/height and then copy the temp image onto the new one created on the server.
You see this with the following code: