Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In belo

Code Block
languagephp
function cfolderResizeImage($file, fn$target_resize($imagewith_resource_id, $widthno_ext, $height, $target_width = 40, $target_height = 40)
{
    $h$source_properties = $height * $target_width / $widthgetimagesize($file);
    if ($h>$target_height)
    {$image_type = $source_properties[2]; 
    if(    $w $image_type == $targetIMAGETYPE_width;
    }JPEG )
    else
{    {
        $h$image_resource_id = $target_height;
        $w = $width * $target_height / $height;imagecreatefromjpeg($file);  
    }

    $target_layer=imagecreatetruecolor($w,$h);
    imagecopyresampled($target_layer, = fn_resize($image_resource_id,$source_properties[0,0,0,0,$w,$h, $width,$height],$source_properties[1]);
    return    imagejpeg($target_layer;
}

function cfolderResizeImage($file, $target_with_no_ext)
{
    $source_properties = getimagesize($file. ".jpg", $target_width, $target_height);
    $image_type = $source_properties[2]; }
    ifelseif( $image_type == IMAGETYPE_JPEGGIF )
    {   
        $image_resource_id = imagecreatefromjpegimagecreatefromgif($file);  
        $target_layer = fn_resize($image_resource_id,$source_properties[0],$source_properties[1]);
        imagejpegimagegif($target_layer, $target_with_no_ext. ".jpg"gif", $target_width, $target_height);
    }
    elseif( $image_type == IMAGETYPE_GIFPNG )
    {  
        $image_resource_id = imagecreatefromgifimagecreatefrompng($file); 
        $target_layer = fn_resize($image_resource_id,$source_properties[0],$source_properties[1]);
        imagegifimagepng($target_layer, $target_with_no_ext. ".gif"png", $target_width, $target_height);
    }
}

function fn_resize($image_resource_id, $width, $height,  elseif( $image_type == IMAGETYPE_PNG $target_width = 40, $target_height = 40)
{
    $h = $height * $target_width / $width;
    if ($h>$target_height)
    {
        $image_resource_id$w = imagecreatefrompng($file); $target_width;
    }
    else
    {
        $h = $target_layerheight;
        $w = fn_resize($image_resource_id,$source_properties[0],$source_properties[1])$width * $target_height / $height;
    }

    imagepng($target_layer=imagecreatetruecolor($w,$h);
    imagecopyresampled($target_withlayer,$image_no_ext. ".png"resource_id,0,0,0,0,$w,$h, $width,$height);
    return $target_layer;
}
}