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) { $handle->file_new_name_body = 'mypic'; $handle->file_max_size = '10857640'; $handle->process($originaldir); if ($handle->processed) { mysql_query("INSERT INTO images SET ImageSourceName='$newname.".$handle->file_src_name_ext."', ImageName='".$handle->file_src_name."', OriginalSize='".$handle->file_src_size."', OriginalWidth='".$handle->image_src_x."', OriginalHeight='".$handle->image_src_y.""); } $handle-> clean(); }
but in database 'OriginalWidth' and 'OriginalHeight' values are zero.