class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
if ($handle->uploaded) { if ($handle->uploaded) { $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 251; $handle->file_new_name_body = $id."G"; $handle->file_overwrite = true; $handle->image_convert = 'jpg'; $handle->process($dir_dest); if ($handle->processed) { $erro = 100; $ximagem = $handle->image_dst_x; $yimagem = $handle->image_dst_y; } else { $erro = 200; } $handle-> clean(); } else { $erro = 200; } $handle->image_ratio_y = true; $handle->image_x = 251; $handle->file_new_name_body = $id."G"; $handle->file_overwrite = true; $handle->image_convert = 'jpg'; $handle->process($dir_dest); if ($handle->processed) { $erro = 100; $ximagem = $handle->image_dst_x; $yimagem = $handle->image_dst_y; } else { $erro = 200; } $handle-> clean();