Imagick::setIteratorIndex

(PECL imagick 2, PECL imagick 3)

Imagick::setIteratorIndex β€” УстанавливаСт ΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ ΠΈΡ‚Π΅Ρ€Π°Ρ‚ΠΎΡ€Π°

ОписаниС

public function Imagick::setIteratorIndex(int $index): bool

УстанавливаСт ΠΈΡ‚Π΅Ρ€Π°Ρ‚ΠΎΡ€ Π² ΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ Π² спискС ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ, ΡƒΠΊΠ°Π·Π°Π½Π½ΡƒΡŽ с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π° index. ΠœΠ΅Ρ‚ΠΎΠ΄ доступСн, Ссли ΠΌΠΎΠ΄ΡƒΠ»ΡŒ Imagick скомпилировали с вСрсиСй ImageMagick 6.2.9 ΠΈΠ»ΠΈ ΡΡ‚Π°Ρ€ΡˆΠ΅.

Бписок ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ²

index

ΠŸΠΎΠ·ΠΈΡ†ΠΈΡ для установки ΠΈΡ‚Π΅Ρ€Π°Ρ‚ΠΎΡ€Π°.

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌΡ‹Π΅ значСния

Ѐункция Π² случаС ΡƒΡΠΏΠ΅ΡˆΠ½ΠΎΠΉ Ρ€Π°Π±ΠΎΡ‚Ρ‹ Π²ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ true.

ΠŸΡ€ΠΈΠΌΠ΅Ρ€Ρ‹

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ #1 ΠŸΡ€ΠΈΠΌΠ΅Ρ€ использования Imagick::setIteratorIndex():

Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ изобраТСния, установка ΠΈ ΠΏΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ индСкса ΠΈΡ‚Π΅Ρ€Π°Ρ‚ΠΎΡ€Π°

<?php
$im
= new Imagick();
$im->newImage(100, 100, new ImagickPixel("red"));
$im->newImage(100, 100, new ImagickPixel("green"));
$im->newImage(100, 100, new ImagickPixel("blue"));

$im->setIteratorIndex(1);
echo
$im->getIteratorIndex();
?>

Π‘ΠΌΠΎΡ‚Ρ€ΠΈΡ‚Π΅ Ρ‚Π°ΠΊΠΆΠ΅

  • Imagick::getIteratorIndex() - Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ индСкс Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ Π°ΠΊΡ‚ΠΈΠ²Π½ΠΎΠ³ΠΎ изобраТСния
  • Imagick::getImageIndex() - Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ индСкс Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ Π°ΠΊΡ‚ΠΈΠ²Π½ΠΎΠ³ΠΎ изобраТСния
  • Imagick::setImageIndex() - УстанавливаСт ΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ ΠΈΡ‚Π΅Ρ€Π°Ρ‚ΠΎΡ€Π°
οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 1 note

up
1
wilcobeekhuizen at gmail dot com ΒΆ
15 years ago
This function returns true on success but setting the iterator to an invalid index throws an exception instead of returning false:
Fatal error: Uncaught exception 'ImagickException' with message 'Unable to set iterator index'

This can happen when counting images inside a gif file, because the iterator count starts at zero and not one. If you count the number of images in a gif file be sure to use iterator 0 for the first image, like this:

<?php
$image = new Imagick('simple.gif');
$image->setIteratorIndex(0);
?>