<?php

function wpir_crop($src,$w,$h) {
	$file = wpir_load_file_from_db($src,'crop',$w,$h);
	if (!$file) {
		$file = wpir_create_cache_file($src,'crop',$w,$h);
		wpir_save_file_on_db($src,$file,'crop',$w,$h);		
	}
	return WPIR_IMAGE_PATH.'/'.$file;
}


function wpir_img($src,$w,$h) {
	$src = wpir_crop($src,$w,$h);
	echo '<img src="'.$src.'" width="'.$w.'" height="'.$h.'" />';
}
