/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk

« back to all changes in this revision

Viewing changes to php/stupid_image.php

  • Committer: Gustav Hartvigsson
  • Date: 2013-04-15 17:08:23 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130415170823-3p331h0cvym4q2q3
Added offset to the stupid rescale and crop function and fixed a bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    You should have received a copy of the GNU Lesser General Public License
18
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
19
*/
20
 
function stupid_rescale_and_crop (Imagick $image, $Height, $Width) {
 
20
function stupid_rescale_and_crop (Imagick $image, $Height, $Width, $offsetX = 0, $offsetY = 0) {
21
21
  //var_dump($image);
22
22
  $imageprops = $image->getImageGeometry();
23
23
  if ($imageprops['height'] == $imageprops['width'] ) {
27
27
  } elseif ($imageprops['height'] < $imageprops['width'] ){
28
28
    $image->resizeImage(0, $Width, imagick::FILTER_LANCZOS, true, false);
29
29
  }
30
 
  $image->cropImage(280,280,0,0);
 
30
  $image->cropImage($Height, $Width, $offsetX, $offsetY);
31
31
 
32
32
  return $image;
33
33
}