Resize image, then resize + crop thumbnail (server speed/performance)

I'm using imagecreatetruecolor and imagejpeg to downsize and save uploaded pictures, and create smaller square thumbnails on an Apache server with php.

Regarding server-performance, memory and speed, which is the best order to do this:

Should I use the initially stored tmp file again to create the thumbnail, or use the newly created smaller image?

The newly created downsized image is smaller (less to load?), but it is an extra file to load, and I don't know if the bigger initial tmp file is already in memory and faster for the server to re-use for a second resize.

Load and resize into 2 sizes
VS
Load and resize + load new and resize


I would use the original file every time you resize, as resizing twice may produce artefacts. In terms of performance, I honestly don't think it makes any difference.

Operating systems today are quite effective in caching files, but even if they weren't, it wouldn't take a long time to load an image consisting of a few megabytes. Unless you're running a very big website, you're unlikely to notice any difference in performance in either case.

链接地址: http://www.djcxy.com/p/61154.html

上一篇: 图像旋转

下一篇: 调整图像大小,然后调整大小+裁剪缩略图(服务器速度/性能)