3 ms·
Firstly, this script ignores the aspect ratio of the incoming image so it'll ruin all your images that aren't perfectly square. That immediately makes it useles
by onion2k 11y ago
Firstly, this script ignores the aspect ratio of the incoming image so it'll ruin all your images that aren't perfectly square. That immediately makes it useless.
Secondly, there is a very, very good image manipulation library for PHP - http://image.intervention.io/ http://image.intervention.io/ - that you should use. (And I say that as the author of PHPImage - https://github.com/onion2k/php-image https://github.com/onion2k/php-image ).
Thirdly, don't put images in a database. To display it you'd have to stream the image data through your database connection in a PHP script, which is far slower than loading it from the filesystem. Store a filename in the database, echo it in your HTML, and let the webserver serve the image as a static file.