• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

PHP Image Crop

hi i need some crop system on php which will crop image to specific size. For example i have images 1200x500, 1320x720. So i want to crop it to 200x200. I want script to take center of it and crop side.
0
umaxim
Asked:
umaxim
1 Solution
 
JF0Commented:
There are several examples on this page that will do what you want. Example 2 and 3 look especially good.

http://us2.php.net/manual/en/function.imagecopyresampled.php 
0
 
umaximAuthor Commented:
i know this example but i need some script wich will crop to perfect 200x200 pixels and cut long side out on left and right side or up and down.
0
 
tsmgeekCommented:
1200x500, 1320x720

(1200-200)/2=500
(500-200)/2=150

so

http://www.php.net/manual/en/function.imagick-cropimage.php
$x1=(1200-200)/2
$y1=(500-200)/2
$picture = new Imagick('animated_gif1.gif');
$picture->cropImage(200, 200, $x1, $y1);

$x2=(1320-200)/2
$y2=(720-200)/2
$picture = new Imagick('animated_gif2.gif');
$picture->cropImage(200, 200, $x2, $y2);

Open in new window

0
 
onemadeyeCommented:
Perhaps these can be helpful for you :

http://www.phpimageeditor.se/

http://www.jpie.net/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now