I have the below code to resize and create the thumbnail of picture's that I have in a folder...
Most of the images on the folder are all different sizes, some have more height then the others. So when I create the thumbnails.. is it possible to have the resize function to first make the image smaller in desired width, as defined below... or say about 140pxl in width, and then take ONLY the the top 100 pxl of the resized image as the height of the image by croping it instead of resizing the thumb into a 140x100 and giving it a funny look.
basically what I am asking for is, have the below lines resize the image in width to 140 pxl
then crop the image starting from the top in 100 pxl in height.
can someone please help me with it.??
PHP Code:
function resizejpg($imagefile,$w)
// check path to prevent illegal access to other files
if(substr($imagefile01) != '.' || strstr($imagefile"..")) {
"Illegal access!";exit;

$ext substr($imagefile, -3);
strtolower($ext) == "jpg") {
      if (!
$src_img imagecreatefromjpeg($imagefile)) {
    } else {

$hw getimagesize($imagefile);
$new_w $w;
$new_h $hw["1"]/($hw["0"]/$w);
$dst_img = @imagecreatetruecolor($new_w$new_h);
$dst_img) {
$dst_img imageCreate($new_w$new_h);


header("Content-type: image/jpeg");

if (
$w == ""){$w "100";}