function create_memdem_images($file) { global $genmem_settings; $image_ext = strtolower(strrchr($file, ".")); $image_res = @getimagesize(INFUSIONS . "al_genmem/asset/generators/originals/" . $file); $image_name = substr($file, 0, strrpos($file, ".")); $image_name_mem = filename_exists(INFUSIONS . "al_genmem/asset/generators/mems/", $image_name . $image_ext); $image_name_dem = filename_exists(INFUSIONS . "al_genmem/asset/generators/dems/", $image_name . ".jpg"); if ($image_ext == ".gif") { $filetype = 1; } elseif ($image_ext == ".jpg") { $filetype = 2; } elseif ($image_ext == ".png") { $filetype = 3; } if ($image_res[0] > $genmem_settings['mem_width'] || $image_res[1] > $genmem_settings['mem_height']) { createthumbnail($filetype, INFUSIONS . "al_genmem/asset/generators/originals/" . $file, INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem, $genmem_settings['mem_width'], $genmem_settings['mem_height']); } else { copy(INFUSIONS . "al_genmem/asset/generators/originals/" . $file, INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem); } $mem_res = @getimagesize(INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem); if ($mem_res[0] > $genmem_settings['mem_width'] - 2 * ($genmem_settings['dem_padding_side'] + $genmem_settings['dem_border'] + $genmem_settings['dem_after_border']) || $mem_res[1] > $genmem_settings['mem_height'] - $genmem_settings['dem_padding_bottom'] - $genmem_settings['dem_padding_top'] - 2 * ($genmem_settings['dem_border'] + $genmem_settings['dem_after_border'])) { $dem_preimage_width = $genmem_settings['mem_width'] - 2 * ($genmem_settings['dem_padding_side'] + $genmem_settings['dem_border'] + $genmem_settings['dem_after_border']); $dem_preimage_height = $genmem_settings['mem_height'] - $genmem_settings['dem_after_bottom'] - $genmem_settings['dem_padding_top'] - 2 * ($genmem_settings['dem_border'] + $genmem_settings['dem_after_border']); } else { $dem_preimage_width = $mem_res[0]; $dem_preimage_height = $mem_res[1]; } $dem_finalimage_width = $dem_preimage_width + 2 * ($genmem_settings['dem_padding_side'] + $genmem_settings['dem_border'] + $genmem_settings['dem_after_border']); $dem_finalimage_height = $dem_preimage_height + $genmem_settings['dem_padding_bottom'] + $genmem_settings['dem_padding_top'] + 2 * ($genmem_settings['dem_border'] + $genmem_settings['dem_after_border']); $dem_file = imagecreatetruecolor($dem_finalimage_width, $dem_finalimage_height); imagefill($dem_file, 0, 0, imagecolorallocate($dem_file, 0, 0, 0)); for ($i = 1; $i <= $genmem_settings['dem_border']; $i++) { imagerectangle($dem_file, $genmem_settings['dem_padding_side'] + $i, $genmem_settings['dem_padding_top'] + $i, $genmem_settings['dem_padding_side'] + 2 * ($genmem_settings['dem_border'] + $genmem_settings['dem_after_border']) + $dem_preimage_width - $i, $genmem_settings['dem_padding_top'] + 2 * ($genmem_settings['dem_border'] + $genmem_settings['dem_after_border']) + $dem_preimage_height - $i, imagecolorallocate($dem_file, 255, 255, 255)); } if ($filetype == 1) { $origimage = imagecreatefromgif(INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem); } elseif ($filetype == 2) { $origimage = imagecreatefromjpeg(INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem); } elseif ($filetype == 3) { $origimage = imagecreatefrompng(INFUSIONS . "al_genmem/asset/generators/mems/" . $image_name_mem); } imagecopyresized($dem_file, $origimage, $genmem_settings['dem_padding_side'] + $genmem_settings['dem_border'] + $genmem_settings['dem_after_border'] + 1, $genmem_settings['dem_padding_top'] + $genmem_settings['dem_border'] + $genmem_settings['dem_after_border'] + 1, 0, 0, $dem_preimage_width, $dem_preimage_height, $mem_res[0], $mem_res[1]); imagejpeg($dem_file, INFUSIONS . "al_genmem/asset/generators/dems/" . $image_name . ".jpg", 100); imagedestroy($dem_file); imagedestroy($origimage); return array("mem" => $image_name_mem, "dem" => $image_name_dem); }
* */ if (function_exists('ini_set')) { @ini_set('memory_limit', '65M'); } /** * Regenerate thumbnails * */ if (function_exists('gd_info')) { $image = mysql_query("SELECT `image` FROM `{$pixelpost_db_prefix}pixelpost`"); $dir = rtrim($cfgrow['imagepath'], "/"); $thumbnail_counter = 0; while ($row = mysql_fetch_assoc($image)) { if (file_exists($dir . '/' . $row['image'])) { $thumbnail = createthumbnail($row['image']); $thumbnail_counter++; } } echo "<div class='jcaption'>{$admin_lang_optn_thumb_updated}</div><div class='content confirm'>{$admin_lang_done} {$thumbnail_counter} {$admin_lang_optn_updated} </div><p> </p>"; } } if (isset($_GET['optaction']) and $_GET['optaction'] == 'updatethumb' and isset($_POST['submit']) or isset($_GET['optaction']) and $_GET['optaction'] == 'updatethumb' and isset($_POST['regenerate'])) { /** * Refresh the settings * */ $cfgrow = sql_array("SELECT * FROM `" . $pixelpost_db_prefix . "config`"); } } // END optionsview / thumbnails
function upload_image($source_image, $target_name = "", $target_folder = IMAGES, $target_width = "1800", $target_height = "1600", $max_size = "150000", $delete_original = false, $thumb1 = true, $thumb2 = true, $thumb1_ratio = 0, $thumb1_folder = IMAGES, $thumb1_suffix = "_t1", $thumb1_width = "100", $thumb1_height = "100", $thumb2_ratio = 0, $thumb2_folder = IMAGES, $thumb2_suffix = "_t2", $thumb2_width = "400", $thumb2_height = "300", $query = "") { if (is_uploaded_file($_FILES[$source_image]['tmp_name'])) { $image = $_FILES[$source_image]; if ($target_name != "" && !preg_match("/[^a-zA-Z0-9_-]/", $target_name)) { $image_name = $target_name; } else { $image_name = stripfilename(substr($image['name'], 0, strrpos($image['name'], "."))); } $image_ext = strtolower(strrchr($image['name'], ".")); $image_res = @getimagesize($image['tmp_name']); $image_info = array("image" => false, "image_name" => $image_name . $image_ext, "image_ext" => $image_ext, "image_size" => $image['size'], "image_width" => $image_res[0], "image_height" => $image_res[1], "thumb1" => false, "thumb1_name" => "", "thumb2" => false, "thumb2_name" => "", "error" => 0, "query" => $query); if ($image_ext == ".gif") { $filetype = 1; } elseif ($image_ext == ".jpg") { $filetype = 2; } elseif ($image_ext == ".png") { $filetype = 3; } else { $filetype = false; } if ($image['size'] > $max_size) { // Invalid file size $image_info['error'] = 1; } elseif (!$filetype) { // Unsupported image type $image_info['error'] = 2; } elseif ($image_res[0] > $target_width || $image_res[1] > $target_height) { // Invalid image resolution $image_info['error'] = 3; } else { $image_name_full = filename_exists($target_folder, $image_name . $image_ext); $image_name = substr($image_name_full, 0, strrpos($image_name_full, ".")); $image_info['image_name'] = $image_name_full; $image_info['image'] = true; move_uploaded_file($image['tmp_name'], $target_folder . $image_name_full); if (function_exists("chmod")) { chmod($target_folder . $image_name_full, 0644); } if ($query && !dbquery($query)) { // Invalid query string $image_info['error'] = 4; unlink($target_folder . $image_name_full); } elseif ($thumb1 || $thumb2) { require_once INCLUDES . "photo_functions_include.php"; $noThumb = false; if ($thumb1) { if ($image_res[0] < $thumb1_width && $image_res[1] < $thumb1_height) { $noThumb = true; $image_info['thumb1_name'] = $image_info['image_name']; $image_info['thumb1'] = true; } else { $image_name_t1 = filename_exists($thumb1_folder, $image_name . $thumb1_suffix . $image_ext); $image_info['thumb1_name'] = $image_name_t1; $image_info['thumb1'] = true; if ($thumb1_ratio == 0) { createthumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width, $thumb1_height); } else { createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width); } } } if ($thumb2) { if ($image_res[0] < $thumb2_width && $image_res[1] < $thumb2_height) { $noThumb = true; $image_info['thumb2_name'] = $image_info['image_name']; $image_info['thumb2'] = true; } else { $image_name_t2 = filename_exists($thumb2_folder, $image_name . $thumb2_suffix . $image_ext); $image_info['thumb2_name'] = $image_name_t2; $image_info['thumb2'] = true; if ($thumb2_ratio == 0) { createthumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width, $thumb2_height); } else { createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width); } } } if ($delete_original && !$noThumb) { unlink($target_folder . $image_name_full); $image_info['image'] = false; } } } } else { // Image not uploaded $image_info = array("error" => 5); } return $image_info; }
$error = 1; } elseif ($album_pic['size'] > $settings['photo_max_b']) { $error = 2; } elseif (!in_array($album_ext, $album_types)) { $error = 3; } else { @unlink(PHOTOS . "temp" . $album_ext); move_uploaded_file($album_pic['tmp_name'], PHOTOS . "temp" . $album_ext); chmod(PHOTOS . "temp" . $album_ext, 0644); $imagefile = @getimagesize(PHOTOS . "temp" . $album_ext); if ($imagefile[0] > $settings['photo_max_w'] || $imagefile[1] > $settings['photo_max_h']) { $error = 4; @unlink(PHOTOS . "temp" . $album_ext); } else { $album_thumb = image_exists(PHOTOS, $album_pic['name']); createthumbnail($imagefile[2], PHOTOS . "temp" . $album_ext, PHOTOS . $album_thumb, $settings['thumb_w'], $settings['thumb_h']); @unlink(PHOTOS . "temp" . $album_ext); } } } if (!$error) { if (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['album_id']) && isnum($_GET['album_id']))) { $old_album_order = dbresult(dbquery("SELECT album_order FROM " . DB_PHOTO_ALBUMS . " WHERE album_id='" . $_GET['album_id'] . "'"), 0); if ($album_order > $old_album_order) { $result = dbquery("UPDATE " . DB_PHOTO_ALBUMS . " SET album_order=(album_order-1)\r\n\t\t\t\t\t\tWHERE album_order>'{$old_album_order}' AND album_order<='{$album_order}'"); } elseif ($album_order < $old_album_order) { $result = dbquery("UPDATE " . DB_PHOTO_ALBUMS . " SET album_order=(album_order+1)\r\n\t\t\t\t\t\tWHERE album_order<'{$old_album_order}' AND album_order>='{$album_order}'"); } $result = dbquery("UPDATE " . DB_PHOTO_ALBUMS . " SET album_title='{$album_title}', album_description='{$album_description}',\r\n\t\t\t\t\t" . (isset($album_thumb) ? " album_thumb='{$album_thumb}'," : "") . " album_user='******'user_id'] . "',\r\n\t\t\t\t\talbum_parent='{$album_parent}', album_access='{$album_access}', album_order='{$album_order}' WHERE album_id='" . $_GET['album_id'] . "'"); // Pimped: Subcategories $rowstart = $album_order > $settings['thumbs_per_page'] ? (ceil($album_order / $settings['thumbs_per_page']) - 1) * $settings['thumbs_per_page'] : "0";
fallback(FUSION_SELF . "?did=" . $download->id . "&errno=" . PDP_EIMGVERIFY); } // check size if ($pdp->settings['image_max_w']) { $size = getimagesize($file); if ($size === false) { $log_event = PDP_EV_PICUPLOAD; $errno = PDP_EFILE; $download->log_event($log_event, $errno); fallback(FUSION_SELF . "?did=" . $download->id . "&errno={$errno}"); } if ($size[0] > $pdp->settings['image_max_w'] || $size[1] > $pdp->settings['image_max_h']) { // scale if ($pdp->settings['image_scale'] == "yes") { $imagefile = @getimagesize($file); createthumbnail($imagefile[2], $file, $file, $pdp->settings['image_max_w'], $pdp->settings['image_max_h']); // do not scale } else { @unlink($file); $log_event = PDP_EV_PICSIZE; $errno = PDP_ESIZE; $download->log_event($log_event, $errno); fallback(FUSION_SELF . '?did=' . $download->id . '&errno=' . $errno); } } } $screen_fn = "'{$screen_fn}'"; // FTP } elseif (isset($_POST['select_ftp']) && !empty($_POST['select_ftp'])) { $log_event = PDP_EV_PICFTP; if (!iPDP_MOD) {
} 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['news_image']['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] > $settings['news_photo_max_w'] || $imagefile[1] > $settings['news_photo_max_h']) { $error = 4; unlink(IMAGES_N . $image_full); } else { createthumbnail($filetype, IMAGES_N . $image_full, IMAGES_N_T . $image_t1, $settings['news_photo_w'], $settings['news_photo_h']); if ($settings['news_thumb_ratio'] == 0) { createthumbnail($filetype, IMAGES_N . $image_full, IMAGES_N_T . $image_t2, $settings['news_thumb_w'], $settings['news_thumb_h']); } else { createsquarethumbnail($filetype, IMAGES_N . $image_full, IMAGES_N_T . $image_t2, $settings['news_thumb_w']); } } } if (!$error) { $news_image = $image_full; $news_image_t1 = $image_t1; $news_image_t2 = $image_t2; } else { $news_image = ""; $news_image_t1 = ""; $news_image_t2 = ""; } } else {
} @unlink($addon_upload_dir_img . $submit_info['addon_screenshot']); @unlink($addon_upload_dir_img . "t_" . $submit_info['addon_screenshot']); move_uploaded_file($_FILES['addon_screen']['tmp_name'], $addon_upload_dir_img . $upload_name . $addon_ext_img); require_once INCLUDES . "photo_functions_include.php"; $fileext = $addon_ext_img; if ($fileext == ".gif") { $filetype = 1; } elseif ($fileext == ".jpg") { $filetype = 2; } elseif ($fileext == ".png") { $filetype = 3; } else { $filetype = false; } createthumbnail($filetype, $addon_upload_dir_img . $upload_name . $addon_ext_img, $addon_upload_dir_img . "t_" . $upload_name . $addon_ext_img, 200, 150); $submit_info['addon_screenshot'] = $upload_name . $addon_ext_img; } } if ($error == "") { // Insert $result = dbquery("INSERT INTO " . DB_ADDONS . " VALUES(\r\n '',\r\n '" . $submit_info['addon_cat_id'] . "',\r\n '" . $submit_info['addon_cat_type'] . "',\r\n '" . $submit_info['addon_status'] . "',\r\n '" . $submit_info['addon_name'] . "',\r\n '" . $submit_info['addon_description'] . "',\r\n '" . $submit_info['addon_demo_url'] . "',\r\n '" . $submit_info['addon_copyright'] . "',\r\n '" . $submit_info['addon_version'] . "',\r\n '" . $submit_info['version_id'] . "',\r\n '" . $submit_info['addon_submitter_name'] . "',\r\n '" . $submit_info['addon_submitter_id'] . "',\r\n '" . $submit_info['addon_forum_status'] . "',\r\n '" . $submit_info['addon_share_status'] . "',\r\n '" . $submit_info['addon_author_name'] . "',\r\n '" . $submit_info['addon_author_status'] . "',\r\n '" . $submit_info['addon_co_author_name'] . "',\r\n '" . $submit_info['addon_author_email'] . "',\r\n '" . $submit_info['addon_author_www'] . "',\r\n '" . $submit_info['addon_date'] . "',\r\n '" . $submit_info['addon_download_list'] . "',\r\n '0',\r\n '" . $submit_info['addon_approved_user'] . "',\r\n '" . $submit_info['addon_approved_rating'] . "',\r\n '" . $submit_info['addon_approved_comment'] . "',\r\n '0',\r\n '" . $submit_info['addon_screenshot'] . "'\r\n )"); // Delete submission $desult = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . $_GET['submit_id'] . "' LIMIT 1"); // Delete Assigned Approver $hunt = dbarray(dbquery("SELECT assign_id FROM " . DB_ADDON_ASSIGN . " WHERE assign_addon = '" . $_GET['submit_id'] . "'")); $result = dbquery("DELETE FROM " . DB_ADDON_ASSIGN . " WHERE assign_id='" . $hunt['assign_id'] . "' LIMIT 1"); $pm_user = dbarray(dbquery("SELECT user_id FROM " . DB_USERS . " WHERE user_name='" . $submit_info['addon_submitter_name'] . "'")); $sendpm = send_pm($pm_user['user_id'], $userdata['user_id'], $locale['addondb500'], $_POST['addon_approved_comment']); } else { echo $error;
$photo_name = str_replace(" ", "_", strtolower(substr($_FILES['file']['name'], 0, strrpos($_FILES['file']['name'], ".")))); $photo_ext = strtolower(strrchr($_FILES['file']['name'], ".")); $targetPath = IMAGES . "mg_photos/"; $new_name = generateName(); while (file_exists($targetPath . $new_name . $photo_ext)) { $new_name = generateName(); } $targetName = $new_name . $photo_ext; $tempFile = $_FILES['file']['tmp_name']; $targetFile = $targetPath . $targetName; move_uploaded_file($tempFile, $targetFile); $origin = $targetName; $size = @getimagesize($targetPath . $origin); if ($size[0] > $mg_settings['photo_width'] || $size[1] > $mg_settings['photo_height']) { $t1 = imageExists($targetPath, $new_name . "_t1" . $photo_ext); createthumbnail($size[2], $targetPath . $origin, $targetPath . $t1, $mg_settings['photo_width'], $mg_settings['photo_height']); } else { $t1 = $origin; } if ($size[0] > $mg_settings['thumb_width'] || $size[1] > $mg_settings['thumb_height']) { $t2 = imageExists($targetPath, $new_name . "_t2" . $photo_ext); createthumbnail($size[2], $targetPath . $origin, $targetPath . $t2, $mg_settings['thumb_width'], $mg_settings['thumb_height']); } else { $t2 = $origin; } if ($mg_settings['upload_original'] == 0) { $origin = ""; } $result = dbquery("INSERT INTO " . DB_MG_PHOTOS . " (photo_title, photo_desc, photo_date, photo_user, photo_album, photo_file, photo_t1, photo_t2) VALUES ('', '', '" . time() . "', '" . $userdata['user_id'] . "', '" . $_REQUEST['album_id'] . "', '" . $origin . "', '" . $t1 . "', '" . $t2 . "')"); // Return JSON-RPC response die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
break; case "updatecalendar": $update = mysql_query("update " . $pixelpost_db_prefix . "config set calendar='" . $_POST['cal'] . "'"); break; case "updatethumbsize": $upquery = mysql_query("update " . $pixelpost_db_prefix . "config set thumbwidth='" . $_POST['thumbwidth'] . "', thumbheight='" . $_POST['thumbheight'] . "'"); break; case "updatethumbnails": if (function_exists('gd_info')) { $thumbnail_counter = 0; $dir = "../images"; // images folder if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thumbnail = createthumbnail($file); $thumbnail_counter++; } // if } // while closedir($handle); echo "<div id='jcaption'>Thumbnails updated</div><div id='content'>{$thumbnail_counter} thumbnails updated.</div><p />"; } // if handle } // if function exists break; $result = mysql_query($update) or die("Error: " . mysql_error()); } if ($_GET['optaction'] != "") {
$extra = 'index.php?view=images'; echo '<meta http-equiv="refresh" content="0;url=http://' . $host . $uri . "/" . $extra . '" />'; } } // Check if the '12c' is selected as the crop then add 3 buttons to the page '+', '-', and 'crop' if ($cfgrow['crop'] == '12c') { $to_echo .= "{$admin_lang_ni_crop_nextstep}<br/>\n\t\t\t\t\t\t <input type='button' name='Submit1' value='" . $txt['cropimage'] . "' onclick=\"cropCheck('def','" . $filnamn . "');\"/>\n\t\t\t\t\t\t <input type='button' name='Submit3' value='" . $txt['smaller'] . "' onmousedown=\"cropZoom('in');\" onmouseup='stopZoom();'/>\n\t\t\t\t\t\t <input type='button' name='Submit4' value='" . $txt['bigger'] . "' onmousedown=\"cropZoom('out');\" onmouseup='stopZoom();'/>\n\t\t\t\t\t\t <br/> "; } echo $to_echo; // tag of content div still open //create thumbnail if (function_exists('gd_info')) { $gd_info = gd_info(); if ($gd_info != "") { $thumbnail = $filnamn; $thumbnail = createthumbnail($thumbnail); eval_addon_admin_workspace_menu('thumb_created'); // if crop is not '12c' use the oldfashioned crop if ($cfgrow['crop'] != '12c') { echo "</div><!-- end of content div -->"; // close content div } else { // set the size of the crop frame according to the uploaded image setsize_cropdiv($filnamn); $for_echo = "<img src='" . $cfgrow['imagepath'] . $filnamn . "' id='myimg'/>\n\t\t\t\t\t\t\t<div id='cropdiv'>\n\t\t\t\t\t\t\t<table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#000000'>\n\t\t\t\t\t\t\t<tr><td><img src='" . $spacer . "'/></td></tr>\n\t\t\t\t\t\t\t</table></div> <!-- end of crop div -->\n\t\t\t\t\t\t\t<div id='editthumbnail'>\n\t\t\t\t\t\t\t<hidden>{$admin_lang_ni_crop_background}</hidden>\n\t\t\t\t\t\t\t</div><!-- end of editthumbnail id -->\n\t\t\t\t\t\t\t</div> <!-- end of content div --> "; echo $for_echo; } // end else } // gd info }
$errored = TRUE; } } // end foreach } // end if isset // update the exif in the database include_once '../includes/functions_exif.php'; $exif_info_db = serialize_exif($cfgrow['imagepath'] . $newfile); mysql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info='{$exif_info_db}' where id='{$theid}'"); if (mysql_error()) { $Errors .= "Insert EXIF information to db error: " . mysql_error() . "<br/>"; $errored = TRUE; } // create thumbnail too createthumbnail($newfile); } // if copy done } else { //someone is trying to copy a file that is not an image. Ignore it. } } // end foreach $Errors .= "</div>"; $message = "<span class='confirm'><b>Copied {$filenumber} files.</b><br />\n\t\t Thumbnails are created while copying files with this addon.</span>"; if ($errored) { $message .= "<span class='confirm'>{$Errors}"; } } $addon_name = "Pixelpost Copy Folder Contents"; $cats_table = category_list_as_table_noecho();
} elseif (!in_array($photo_ext, $photo_types)) { $error = 2; } elseif (!is_uploaded_file($photo_temp)) { $error = 5; } else { move_uploaded_file($photo_temp, $photo_dest . $photo_name . $photo_ext); $gimage = $photo_name . $photo_ext; $size = @getimagesize($photo_dest . $photo_name . $photo_ext); if ($size[0] > 1800 || $size[1] > 1600) { $error = 3; unlink($photo_dest . $photo_name . $photo_ext); } else { if ($size[0] > 200 || $size[1] > 200) { $photo_resized = $photo_name . "_thumb" . $photo_ext; $gimage = $photo_resized; createthumbnail($size[2], $photo_dest . $photo_name . $photo_ext, $photo_dest . $photo_resized, 200, 200); } // resize } } } else { // name != "" $gimage = 0; } if ($gname == "") { $error = 10; } if ($error > 0) { redirect(BASEDIR . "group_admin.php?action=create&error=" . $error); } else { $create = dbquery("INSERT INTO " . DB_GS_GROUPS . " (group_name, group_image, group_creator, group_cat, group_stat) VALUES ('" . $gname . "', '" . $gimage . "', '" . $userdata['user_id'] . "', '" . $_POST['gcat'] . "', '0')");
$photo_resized = $photo_name . $photo_ext; } } else { $photo_resized = ""; } // tbig if ($size[0] > $settings['photo_w'] || $size[1] > $settings['photo_h']) { $photo_tbig = $photo_name . "_tbig" . $photo_ext; createthumbnail($size[2], $photo_dest . $photo_name . $photo_ext, $photo_dest . $photo_tbig, $settings['photo_w'], $settings['photo_h']); } else { $photo_tbig = $photo_name . $photo_ext; } // tsmall if ($size[0] > 150 || $size[1] > 150) { $photo_tsmall = $photo_name . "_tsmall" . $photo_ext; createthumbnail($size[2], $photo_dest . $photo_name . $photo_ext, $photo_dest . $photo_tsmall, 150, 150); } else { $photo_tsmall = $photo_name . $photo_ext; } } // err 3 } // err 5 if ($error == "") { // insert db, redir 2 img $photo_orig = $photo_name . $photo_ext; $photo_user = iMEMBER ? $userdata['user_id'] : "0"; $result = dbquery("INSERT INTO " . DB_IMH_IMAGES . " (image_user, image_size, image_type, image_resize, image_views, image_original, image_tsmall, image_tbig, image_resized) VALUES ('" . $photo_user . "', '" . $photo_size . "', '" . $photo_ext . "', '" . $_POST['resize'] . "', '1', '" . $photo_orig . "', '" . $photo_tsmall . "', '" . $photo_tbig . "', '" . $photo_resized . "')"); if ($result) { $id = mysql_insert_id(); redirect(BASEDIR . "imagehost.php?p=image&id=" . $id);
if ($_FILES['userfile']['tmp_name'] != "") { $oldfilename = $_POST['oldfilename']; $userfile = strtolower($_FILES['userfile']['name']); $uploadfile = $upload_dir . $oldfilename; // NEW WORKSPACE ADDED eval_addon_admin_workspace_menu('image_reupload_start'); if (getimagesize($_FILES['userfile']['tmp_name'])) { if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { chmod($uploadfile, 0644); $result = check_upload($_FILES['userfile']['error']); //$filnamn =strtolower($_FILES['userfile']['name']); //$filnamn = $oldfilename $filtyp = $_FILES['userfile']['type']; $filstorlek = $_FILES['userfile']['size']; $status = "ok"; createthumbnail($oldfilename); //Get the exif data so we can store it. include_once '../includes/functions_exif.php'; $exif_info_db = serialize_exif($uploadfile); $update = sql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info='{$exif_info_db}' where id='{$getid}'"); $file_reupload_str = '<br/>' . $admin_lang_imgedit_file . '<b>' . $oldfilename . '</b> ' . $admin_lang_imgedit_file_isuploaded; // NEW WORKSPACE ADDED eval_addon_admin_workspace_menu('image_reupload_succesful'); } else { // something went wrong, try to describe what if ($_FILES['userfile']['error'] != '0') { $result = check_upload($_FILES['userfile']['error']); } else { $result = "{$admin_lang_ni_upload_error}"; } echo "<div id='warning'>{$admin_lang_error} ";
protected function verify_image_upload() { $locale = fusion_get_locale(); require_once INCLUDES . "infusions_include.php"; if ($this->field_config['multiple']) { $target_folder = $this->field_config['path']; $target_width = $this->field_config['max_width']; $target_height = $this->field_config['max_height']; $max_size = $this->field_config['max_byte']; $delete_original = $this->field_config['delete_original']; $thumb1 = $this->field_config['thumbnail']; $thumb2 = $this->field_config['thumbnail2']; $thumb1_ratio = 1; $thumb1_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/"; $thumb1_suffix = $this->field_config['thumbnail_suffix']; $thumb1_width = $this->field_config['thumbnail_w']; $thumb1_height = $this->field_config['thumbnail_h']; $thumb2_ratio = 0; $thumb2_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/"; $thumb2_suffix = $this->field_config['thumbnail2_suffix']; $thumb2_width = $this->field_config['thumbnail2_w']; $thumb2_height = $this->field_config['thumbnail2_h']; $query = ''; if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][0]) && $this->safe()) { $result = array(); for ($i = 0; $i <= count($_FILES[$this->field_config['input_name']]['name']) - 1; $i++) { if (is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][$i])) { $image = $_FILES[$this->field_config['input_name']]; $target_name = $_FILES[$this->field_config['input_name']]['name'][$i]; if ($target_name != "" && !preg_match("/[^a-zA-Z0-9_-]/", $target_name)) { $image_name = $target_name; } else { $image_name = stripfilename(substr($image['name'][$i], 0, strrpos($image['name'][$i], "."))); } $image_ext = strtolower(strrchr($image['name'][$i], ".")); $image_res = array(); if (filesize($image['tmp_name'][$i]) > 10 && @getimagesize($image['tmp_name'][$i])) { $image_res = @getimagesize($image['tmp_name'][$i]); } $image_info = array("image" => FALSE, "image_name" => $image_name . $image_ext, "image_ext" => $image_ext, "image_size" => $image['size'], "image_width" => $image_res[0], "image_height" => $image_res[1], "thumb1" => FALSE, "thumb1_name" => "", "thumb2" => FALSE, "thumb2_name" => "", "error" => 0); if ($image_ext == ".gif") { $filetype = 1; } elseif ($image_ext == ".jpg") { $filetype = 2; } elseif ($image_ext == ".png") { $filetype = 3; } else { $filetype = FALSE; } if ($image['size'][$i] > $max_size) { // Invalid file size $image_info['error'] = 1; } elseif (!$filetype || !verify_image($image['tmp_name'][$i])) { // Unsupported image type $image_info['error'] = 2; } elseif ($image_res[0] > $target_width || $image_res[1] > $target_height) { // Invalid image resolution $image_info['error'] = 3; } else { if (!file_exists($target_folder)) { mkdir($target_folder, 0755); } $image_name_full = filename_exists($target_folder, $image_name . $image_ext); $image_name = substr($image_name_full, 0, strrpos($image_name_full, ".")); $image_info['image_name'] = $image_name_full; $image_info['image'] = TRUE; move_uploaded_file($image['tmp_name'][$i], $target_folder . $image_name_full); if (function_exists("chmod")) { chmod($target_folder . $image_name_full, 0755); } if ($query && !dbquery($query)) { // Invalid query string $image_info['error'] = 4; if (file_exists($target_folder . $image_name_full)) { @unlink($target_folder . $image_name_full); } } elseif ($thumb1 || $thumb2) { require_once INCLUDES . "photo_functions_include.php"; $noThumb = FALSE; if ($thumb1) { if ($image_res[0] <= $thumb1_width && $image_res[1] <= $thumb1_height) { $noThumb = TRUE; $image_info['thumb1_name'] = $image_info['image_name']; $image_info['thumb1'] = TRUE; } else { if (!file_exists($thumb1_folder)) { mkdir($thumb1_folder, 0755, TRUE); } $image_name_t1 = filename_exists($thumb1_folder, $image_name . $thumb1_suffix . $image_ext); $image_info['thumb1_name'] = $image_name_t1; $image_info['thumb1'] = TRUE; if ($thumb1_ratio == 0) { createthumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width, $thumb1_height); } else { createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width); } } } if ($thumb2) { if ($image_res[0] < $thumb2_width && $image_res[1] < $thumb2_height) { $noThumb = TRUE; $image_info['thumb2_name'] = $image_info['image_name']; $image_info['thumb2'] = TRUE; } else { if (!file_exists($thumb2_folder)) { mkdir($thumb2_folder, 0755, TRUE); } $image_name_t2 = filename_exists($thumb2_folder, $image_name . $thumb2_suffix . $image_ext); $image_info['thumb2_name'] = $image_name_t2; $image_info['thumb2'] = TRUE; if ($thumb2_ratio == 0) { createthumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width, $thumb2_height); } else { createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width); } } } if ($delete_original && !$noThumb) { unlink($target_folder . $image_name_full); $image_info['image'] = FALSE; } } } } else { $image_info = array("error" => 5); } if ($image_info['error'] != 0) { $this->stop(); // return FALSE if possible switch ($image_info['error']) { case 1: // Invalid file size addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte']))); self::setInputError($this->field_name); break; case 2: // Unsupported image type addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png")); self::setInputError($this->field_name); break; case 3: // Invalid image resolution addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height'])); self::setInputError($this->field_name); break; case 4: // Invalid query string addNotice('danger', $locale['df_422']); self::setInputError($this->field_name); break; case 5: // Image not uploaded addNotice('danger', $locale['df_423']); self::setInputError($this->field_name); break; } $result[$i] = $image_info; } else { $result[$i] = $image_info; } } // end for return $result; } else { return array(); } } else { if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name']) && $this->safe()) { $upload = upload_image($this->field_config['input_name'], $_FILES[$this->field_config['input_name']]['name'], $this->field_config['path'], $this->field_config['max_width'], $this->field_config['max_height'], $this->field_config['max_byte'], $this->field_config['delete_original'], $this->field_config['thumbnail'], $this->field_config['thumbnail2'], 1, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail_suffix'], $this->field_config['thumbnail_w'], $this->field_config['thumbnail_h'], 0, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail2_suffix'], $this->field_config['thumbnail2_w'], $this->field_config['thumbnail2_h']); if ($upload['error'] != 0) { $this->stop(); switch ($upload['error']) { case 1: // Invalid file size addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte']))); self::setInputError($this->field_name); break; case 2: // Unsupported image type addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png")); self::setInputError($this->field_name); break; case 3: // Invalid image resolution addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height'])); self::setInputError($this->field_name); break; case 4: // Invalid query string addNotice('danger', $locale['df_422']); self::setInputError($this->field_name); break; case 5: // Image not uploaded addNotice('danger', $locale['df_423']); self::setInputError($this->field_name); break; } return $upload; } else { return $upload; } } else { return array(); } } }
$avatarext = strrchr($avatarname, "."); $avatarname = substr($avatarname, 0, strrpos($avatarname, ".")); if (preg_match("/^[-0-9A-Z_\\[\\]]+\$/i", $avatarname) && preg_match("/(\\.gif|\\.GIF|\\.jpg|\\.JPG|\\.jpeg|\\.JPEG|\\.png|\\.PNG)\$/", $avatarext)) { $avatarname = $avatarname . "[" . $userdata['user_id'] . "]" . $avatarext; $image = stripinput($_POST['user_avatarnet']); copy($image, IMAGES_AVA . $avatarname); // Some more checks if (!verify_image(IMAGES_AVA . $avatarname)) { @unlink(IMAGES_AVA . $avatarname); $set_avatar = ""; } else { $imagefile = getimagesize(IMAGES_AVA . $avatarname); $avatarname_thumb = image_exists(IMAGES_AVA, $avatarname); if ($imagefile[0] > $settings['avatar_width'] || $imagefile[1] > $settings['avatar_height']) { if ($settings['avatar_ratio'] == 0) { createthumbnail($imagefile[2], IMAGES_AVA . $avatarname, IMAGES_AVA . $avatarname_thumb, $settings['avatar_width'], $settings['avatar_height']); } else { createsquarethumbnail($imagefile[2], IMAGES_AVA . $avatarname, IMAGES_AVA . $avatarname_thumb, $settings['avatar_width']); } @unlink(IMAGES_AVA . $avatarname); $set_avatar = ", user_avatar='" . $avatarname_thumb . "'"; } else { $set_avatar = ", user_avatar='" . $avatarname . "'"; } } } } } /* End code for avatar URL input */ if (!$error) { $result = dbquery("SELECT * FROM " . DB_USER_FIELDS . " tuf\r\n\t\tINNER JOIN " . DB_USER_FIELD_CATS . " tufc ON tuf.field_cat = tufc.field_cat_id\r\n\t\tORDER BY field_cat_order, field_order");
$photo_title = stripinput($_POST['photo_title']); $photo_description = stripinput($_POST['photo_description']); $album_id = isnum($_POST['album_id']) ? $_POST['album_id'] : "0"; $photo_name = strtolower(substr($submit_criteria['photo_file'], 0, strrpos($submit_criteria['photo_file'], "."))); $photo_ext = strtolower(strrchr($submit_criteria['photo_file'], ".")); $photo_dest = PHOTOS . (!SAFEMODE ? "album_" . $album_id . "/" : ""); $photo_file = image_exists($photo_dest, $photo_name . $photo_ext); copy(PHOTOS . "submissions/" . $submit_criteria['photo_file'], $photo_dest . $photo_file); chmod($photo_dest . $photo_file, 0644); unlink(PHOTOS . "submissions/" . $submit_criteria['photo_file']); $imagefile = @getimagesize($photo_dest . $photo_file); $photo_thumb1 = image_exists($photo_dest, $photo_name . "_t1" . $photo_ext); createthumbnail($imagefile[2], $photo_dest . $photo_file, $photo_dest . $photo_thumb1, $settings['thumb_w'], $settings['thumb_h']); if ($imagefile[0] > $settings['photo_w'] || $imagefile[1] > $settings['photo_h']) { $photo_thumb2 = image_exists($photo_dest, $photo_name . "_t2" . $photo_ext); createthumbnail($imagefile[2], $photo_dest . $photo_file, $photo_dest . $photo_thumb2, $settings['photo_w'], $settings['photo_h']); } $photo_order = dbresult(dbquery("SELECT MAX(photo_order) FROM " . DB_PHOTOS . " WHERE album_id='{$album_id}'"), 0) + 1; $result = dbquery("INSERT INTO " . DB_PHOTOS . " (album_id, photo_title, photo_description, photo_filename, photo_thumb1, photo_thumb2, photo_datestamp, photo_user, photo_views, photo_order, photo_allow_comments, photo_allow_ratings) VALUES ('{$album_id}', '{$photo_title}', '{$photo_description}', '{$photo_file}', '{$photo_thumb1}', '{$photo_thumb2}', '" . time() . "', '" . $data['submit_user'] . "', '0', '{$photo_order}', '1', '1' ,'" . LANGUAGE . "')"); $result = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . $_GET['submit_id'] . "'"); opentable($locale['580']); echo "<br /><div style='text-align:center'>" . $locale['581'] . "<br /><br />\n"; echo "<a href='" . FUSION_SELF . $aidlink . "'>" . $locale['402'] . "</a><br /><br />\n"; echo "<a href='index.php" . $aidlink . "'>" . $locale['403'] . "</a></div><br />\n"; closetable(); } else { redirect(FUSION_SELF . $aidlink); } } else { if (isset($_POST['delete']) && (isset($_GET['submit_id']) && isnum($_GET['submit_id']))) { opentable($locale['582']);
<?php include 'generator.php'; $opts = ['library' => 'avconv', 'videotypes' => array('video/mp4', 'video/x-flv'), 'input' => 'http://www.medien-tube.de/images/media/5601.flv', 'name' => 'video', 'output' => '.', 'timespan' => '10', 'width' => 120, 'verbose' => FALSE, 'poster' => TRUE, 'delete' => TRUE]; try { $var = createthumbnail($opts); } catch (ThumbnailWebVttException $e) { $var = false; echo $e->getMessage(); } var_dump($var);