使用php生成图像缩略图-不会耗尽内存 [英] Generating image thumbnails using php - without running out of memory

查看:211
本文介绍了使用php生成图像缩略图-不会耗尽内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用php gd实现来调整图像大小,这些图像不断地耗尽内存-速度很快.我想问题是php函数,例如imagecreatefromstring等.

I am currently using a php gd implementation to resize images which constantly runs out of memory - rather quickly. I guess the problem are the php functions, like imagecreatefromstring etc.

是否有一个简单的实现来调整不使用此功能的图像的大小,因此我不必增加php.ini的内存限制?

Is there an easy implementation to resizing images which doesn't use this functions, so I won't have to increase my php.ini memory limit?

推荐答案

GD不使用那么多的内存,因此您的代码中还有其他问题.

GD don't use that much memory, so you have other problems in your code.

如果您调整多个图像的大小并且不对新创建的图像调用imagedestroy,则会在内存泄漏中运行.

If you resize multiple images and don't call imagedestroy on a newly created image, you run in memory leaks.

这篇关于使用php生成图像缩略图-不会耗尽内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆