Jquery Guillotine + PhpThumbFactory

101 views
Skip to first unread message

Willy SWENDRA

unread,
Aug 10, 2015, 7:22:28 AM8/10/15
to jQuery Guillotine
Hi, 

Thanks for your excellent plugin.

I want get data for work image with the phpThumbFactory plugin in php but I don't exactly cut the correct value
Perhaps we need make a conversion...?

My code : 
// getdata : OK
                                        $x = $_POST['img_x'];
$y = $_POST['img_y'];
$w = $_POST['img_w'];
$h = $_POST['img_h'];
$scale = $_POST['img_scale'];
$angle = $_POST['img_angle'];

// Create the object PhpThumbFactory
try
{
    $thumb = PhpThumbFactory::create($UPLOAD_PHOTOS_LIVRES.$nom_photo);

}
catch (Exception $e)
{
    // handle error here however you'd like
echo "Erreur : <br />".$e;

}

// Works the picture
$thumb->rotateImageNDegrees($angle);//ok
$thumb->crop($x, $y, $w , $h);
$thumb->resizePercent($scale*100); // ok
$thumb->save($UPLOAD_PHOTOS_LIVRES.$nom_photo);


2. An another question : 
In guillotine init, the width and height make the size of the image to crop but when it's a limit zoomout and my pics it's bad cropped.
In fact, i can't see the full image.
Can i defined the limit zoom out ? For more scale ?

Thanks for your help.

W-prog.com

mgag....@gmail.com

unread,
Aug 13, 2015, 1:17:41 AM8/13/15
to jQuery Guillotine
Hi Willy.

I haven't used "phpThumbFactory" but after going throught your code I'd say that the problem is the order in which you are applying the transformations to the image.

In your code you rotate, crop and resize (in that order) instead of rotating and scaling before cropping (5th step in Guillotine's Readme: "Handle cropping instructions").

'x' and 'y' are coordinates over the image after it's been rotated and scaled, so rotate and scale before cropping and you should be good to go.

Correct me if I'm wrong, but for your second question I think you are refering to the same as this.

Hope this helps, Matías.


Willy SWENDRA

unread,
Aug 13, 2015, 5:14:24 AM8/13/15
to jQuery Guillotine
Hi Matias, 
Ok, i understood. I do it.
Thanks so much.
Willy
Reply all
Reply to author
Forward
0 new messages