Skip to content

Instantly share code, notes, and snippets.

View rbncha's full-sized avatar

Rubin Shrestha rbncha

View GitHub Profile
@rbncha
rbncha / image-resize-crop.php
Created January 19, 2012 11:52
Wordpress Image resize and crop function
<?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) );