ini_set("memory_limit","40M");
$upload_errors = array(
// http://www.php.net/manual/en/features.file-upload.errors.php
UPLOAD_ERR_OK => "No errors.",
UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.",
UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.",
UPLOAD_ERR_PARTIAL => "Partial upload.",
UPLOAD_ERR_NO_FILE => "No file.",
UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.",
UPLOAD_ERR_CANT_WRITE => "Can't write to disk.",
UPLOAD_ERR_EXTENSION => "File upload stopped by extension."
);
/*
1) text size dynamically
2) format for phone
3) preview before saving
4) choose text color (block or white)
5) support for png
6) admin features for quickly deleting
*/
?>
Meme Creator
Create a Meme. We will print them out and display them in the gallery
if(isset($_POST['submit'])) {
// process the form data
$tmp_file = $_FILES['file_upload']['tmp_name'];
$target_file = basename($_FILES['file_upload']['name']);
$upload_dir = "upload";
// You will probably want to first use file_exists() to make sure
// there isn't already a file by the same name.
// move_uploaded_file will return false if $tmp_file is not a valid upload file
// or if it cannot be moved for any other reason
if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)) {
// $imagen = ImageCreateFromJPEG($upload_dir."/".$target_file);
$imagen = new Imagick($upload_dir."/".$target_file);
$imagen->scaleImage(600, 0);
$imagen->writeImage($upload_dir."/m".$target_file);
unlink($upload_dir."/".$target_file);
$message = "File uploaded successfully.";
} else {
$error = $_FILES['file_upload']['error'];
$message = $upload_errors[$error];
}
}
//
?>