To resize a image before uploading you will need Javascript, as PHP will only execute after the upload. Basically: - Get a handle to the selected file and read it (https://developer.mozilla.org/pt-BR/docs/Web/API/FileReader) - Create a hidden img element and set its src to the selected file's base64 content - Create a hidden canvas element (using document.createElement) with the width and height you want - Draw the image in the canvas - Use the "toDataURL()" canvas method to get the new image's base64 content and upload it as text
You can use intervention library http://image.intervention.io/
Обсуждают сегодня