Created
January 3, 2017 19:31
-
-
Save mahbub-shohag/d0becc94ac17d4e15d1ea5d816034aec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/verot/class.upload.php/blob/master/README.md | |
$foo = new Upload($_FILES['form_field']); | |
if ($foo->uploaded) { | |
// save uploaded image with no changes | |
$foo->Process('/home/user/files/'); | |
if ($foo->processed) { | |
echo 'original image copied'; | |
} else { | |
echo 'error : ' . $foo->error; | |
} | |
// save uploaded image with a new name | |
$foo->file_new_name_body = 'foo'; | |
$foo->Process('/home/user/files/'); | |
if ($foo->processed) { | |
echo 'image renamed "foo" copied'; | |
} else { | |
echo 'error : ' . $foo->error; | |
} | |
// save uploaded image with a new name, | |
// resized to 100px wide | |
$foo->file_new_name_body = 'image_resized'; | |
$foo->image_resize = true; | |
$foo->image_convert = gif; | |
$foo->image_x = 100; | |
$foo->image_ratio_y = true; | |
$foo->Process('/home/user/files/'); | |
if ($foo->processed) { | |
echo 'image renamed, resized x=100 | |
and converted to GIF'; | |
$foo->Clean(); | |
} else { | |
echo 'error : ' . $foo->error; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment