Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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 http://tecadmin.net/install-imagemagick-on-linux/ Can you help me?, Thanks



4.7k
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());



33.1k

@Piotr

That is working, thanks