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 Resize

Where does phalcon gd apater store image file before save() function call??? I have to upload resized image file to Amazon Aws which needs resized image path



4.4k
Accepted
answer

Hi, to generate a resized image try this code:

<?php
if($upload->moveTo($path))
         {
                   $name_of_miniature = "example_name123";
                   $img = new Phalcon\Image\Adapter\Gd($path); 
                   $path_mini = "img/miniatures/".$name_of_miniature.".jpg"; 
                    //117 px width, 90 px height
                    $img->resize(117,90)->crop(117,90);
                    if($img->save($path_mini, 100))
                    {
                      //  ok
                    }
                    else
                    {
                      // bad
                    }
         }

Thanks PolDeveloper I have resized image and store that image to temp directory of my linux machine and upload to Amazon from that path

Hi, to generate a resized image try this code:

```php

<?php if($upload->moveTo($path)) { $nameofminiature = "examplename123"; $img = new Phalcon\Image\Adapter\Gd($path); $pathmini = "img/miniatures/".$nameofminiature.".jpg"; //117 px width, 90 px height $img->resize(117,90)->crop(117,90); if($img->save($path_mini, 100)) { // ok } else { // bad } }

```

Very Good. Cheers!