php 图片处理慢,php – 用imagemagick创建图片太慢了.如何提高?

我最近遇到了同样的问题,但我只是通过图像一次将它们从原来的2592×1944调整为300xbestFit或bestFitx300

我使用的是PHP类imagick而不是命令行,但是在我的情况下,通过更改为-scale或scaleImage,我将时间缩短了一半.这是我的测试代码的片段.

while ($images = readdir($handle)) {

// check to see if the first or second character is a '.' or '..',

// if so then remove from list

if (substr($images,0,1) != '.') {

//Check files to see if there extensions match any of the following image extensions.

// GLOB_BRACE looks for all glob criteria within the {braces}

$images = glob($dir."{*.gif,*.jpg,*.png,*.jpeg}", GLOB_BRACE);

// the glob function gives us an array of images

$i = 0;

foreach ($images as $image) {

// parse the data given and remove the images/ $dir,

// imagemagick will not take paths, only image names.

$i++;

list ($dir, $image) = s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值