Skip to content

Instantly share code, notes, and snippets.

View mvnp's full-sized avatar
🏠
Working from home

Marcos Pereira mvnp

🏠
Working from home
View GitHub Profile
@jasdeepkhalsa
jasdeepkhalsa / imageCropAdvanced.php
Created December 19, 2012 20:02 — forked from anonymous/imageCropAdvanced.php
Using PHP and GD to crop an image proportionally according to its aspect ratio. From: http://stackoverflow.com/questions/1855996/crop-image-in-php
<?php
$image = imagecreatefromjpeg($_GET['src']);
$filename = 'images/cropped_whatever.jpg';
$thumb_width = 200;
$thumb_height = 150;
$width = imagesx($image);
$height = imagesy($image);