echo "<td class='tbl'><input type='file' name='article_image' class='textbox' style='width:250px;' /></td>\n";
if (isset($_POST['save'])) {
if (isset($_FILES['article_image']) && is_uploaded_file($_FILES['article_image']['tmp_name'])) {
require_once INCLUDES."photo_functions_include.php";
$image = $_FILES['article_image'];
$image_name = stripfilename(str_replace(" ", "_", strtolower(substr($image['name'], 0, strrpos($image['name'], ".")))));
$image_ext = strtolower(strrchr($image['name'],"."));
if ($image_ext == ".gif") { $filetype = 1;
} elseif ($image_ext == ".jpg") { $filetype = 2;
} elseif ($image_ext == ".png") { $filetype = 3;
} else { $filetype = false; }
if (!preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $image_name)) {
$error = 1;
} elseif ($image['size'] > $settings['article_photo_max_b']){
$error = 2;
} elseif (!$filetype) {
$error = 3;
} else {
$image_t1 = image_exists(IMAGES_N_T, $image_name."_t1".$image_ext);
$image_t2 = image_exists(IMAGES_N_T, $image_name."_t2".$image_ext);
$image_full = image_exists(IMAGES_N, $image_name.$image_ext);
move_uploaded_file($_FILES['article_obrazek']['tmp_name'], IMAGES_N.$image_full);
if (function_exists("chmod")) { chmod(IMAGES_N.$image_full, 0644); }
$imagefile = @getimagesize(IMAGES_N.$image_full);
if ($imagefile[0] > 1800 || $imagefile[1] > 1600) {
$error = 4;
unlink(IMAGES_N.$image_full);
} else {
createthumbnail($filetype, IMAGES_N.$image_full, IMAGES_N_T.$image_t1, 120, 120);
createthumbnail($filetype, IMAGES_N.$image_full, IMAGES_N_T.$image_t2, 250, 250);
}
}
if (!$error) {
$article_image = $image_full;
$article_image_t1 = $image_t1;
$article_image_t2 = $image_t2;
} else {
$article_image = "";
$article_image_t1 = "";
$article_image_t2 = "";
}
} else {
$article_image = (isset($_POST['article_image']) ? (preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $_POST['article_image']) ? $_POST['article_image'] : "") : "");
$article_image_t1 = (isset($_POST['article_image_t1']) ? (preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $_POST['article_image_t1']) ? $_POST['article_image_t1'] : "") : "");
$article_image_t2 = (isset($_POST['article_image_t2']) ? (preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $_POST['article_image_t2']) ? $_POST['article_image_t2'] : "") : "");
}
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
1 participant
Notifications
You are not receiving notifications from this thread.
Related Questions