All pastes #763337 Raw Edit

Something

public php v1 · immutable
·published 2007-11-06 11:36 UTC
rendered paste body
//// include it where the upload is made img_res.php//...$fullpath = fullpath.... / clean name = ---   $clean_name = ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower(POSTED PIC) ) ) );move_uploaded_file($tmp_name,$fullpath6.$clean_name); $red='th_';$viw = 'no_';ImageJpgRedimension($fullpath.$clean_name, 600, $fullpath.$clean_name);ImageJpgRedimension($fullpath.$clean_name, 200, $fullpath.$red.$clean_name);//...///img res php <?phpfunction ImageJpgRedimension ($link, $max, $newlink){    //current dimension    $currentimagesize = @getimagesize($link);    if (false === $currentimagesize) return false;    $image_width = $currentimagesize[0];    $image_height= $currentimagesize[1];    //redimension    if (($image_height > $max) || ($image_width > $max))    {        if ($image_height > $image_width) $sizefactor = doubleval($max / $image_height);        else $sizefactor = doubleval($max / $image_width) ;    }    else $sizefactor = 1;    $newwidth = intval($image_width * $sizefactor);    $newheight = intval($image_height * $sizefactor);    //Set up picture    $thumb = @imagecreatetruecolor($newwidth, $newheight);    $white = @imagecolorallocate($thumb, 255, 255, 255);    $grey = @imagecolorallocate($thumb, 150, 150, 150);    $red = @imagecolorallocate($thumb, 255, 0, 0);    @imagefill($thumb, 0, 0, $white);    $big = @imagecreatefromjpeg ($link);    if (false === @imagecopyresampled($thumb, $big, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height)) return false;    if (imagejpeg($thumb,$newlink) && imagedestroy($thumb)) return true;    else return false;}?>