note 115506 added to imagick.examples-1
| From: | vokseli | Date: | Wed, 06 Aug 2014 07:24:51 +0000 |
| Subject: | note 115506 added to imagick.examples-1 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200129@lists.php.net to get a copy of this message | ||
Be careful when loading multiple images by passing an array to a new Imagick object. This is from
Example #2:
<?php
$images = new Imagick(glob('images/*.JPG'));
?>
If you have lots of images inside the images folder, PHP will consume a lot of memory, ergo it is
not recommended. I personally think it's a better idea to loop each image separately:
<?php
$image_files = glob('images/*.JPG');
foreach ($image_files as $image_file) {
$image = new Imagick($image_file);
// Do something for the image and so on...
}
?>
This way only a single image is fitted into the memory at a time.
----
Server IP: 72.52.91.14
Probable Submitter: 83.145.237.166
----
Manual Page -- http://php.net/manual/en/imagick.examples-1.php
Edit -- https://master.php.net/note/edit/115506
Del: integrated -- https://master.php.net/note/delete/115506/integrated
Del: useless -- https://master.php.net/note/delete/115506/useless
Del: bad code -- https://master.php.net/note/delete/115506/bad+code
Del: spam -- https://master.php.net/note/delete/115506/spam
Del: non-english -- https://master.php.net/note/delete/115506/non-english
Del: in docs -- https://master.php.net/note/delete/115506/in+docs
Del: other reasons-- https://master.php.net/note/delete/115506
Reject -- https://master.php.net/note/reject/115506
Search -- https://master.php.net/manage/user-notes.php