We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Image Manipulation Component

HI all

I see new feature in Phalcon and I tried it but it working(my version Phalcon 1.3.2, OS fedora 20)

<?php

$image = new Phalcon\Image\Adapter\Imagick("upload/test.jpg");
$image->resize(200, 200)->rotate(90)->crop(100, 100);
if ($image->save()) {
    echo 'success';
}

I get errror as below:

Fatal error: Class 'Imagick' not found in 

And now I tried case orther

foreach ($this->request->getUploadedFiles() as $file) {
    $image = new GD($file->getName());
    $image->resize(200, 200)->rotate(90)->crop(100, 100);
    if ($image->save()) {
        echo 'success';
    }
    //Print file details
    echo $file->getName(), " ", $file->getSize(), "\n";
    //Move the file into the application
    $file->moveTo('images/u/' . $file->getName());
}

I get error

Failed to create image from file 'dev.jpg'

Aslo I have install images php extension here https://tecadmin.net/install-imagemagick-on-linux/ Can you help me?, Thanks



6.5k
Accepted
answer

Fatal error: Class 'Imagick' not found in

You need to have PHP Imagick extnesion installed and enabled for this to work.

$image = new GD($file->getName());

I believe that the GD adapter needs to receive full path to the uploaded file: $image = new GD($file->getTempName());



58.4k

@Piotr

That is working, thanks