Skip to content

Instantly share code, notes, and snippets.

Avatar

Rubin Shrestha rbncha

View GitHub Profile
@rbncha
rbncha / image-resize-crop.php
Created Jan 19, 2012
Wordpress Image resize and crop function
View image-resize-crop.php
<?php
/**
* This function is used to resize and crop image
* based on width from the center of the image
*
* creates new image from jpg,gif,png,bmp to png images
*/
function image_resize_crop ( $src, $w, $h, $dest = null, $override = false, $createNewIfExists = false ) {
$ext = array_pop ( explode ('.', $src) );
$filenameSrc = str_replace (".$ext", '', basename($src) );