function saveGift() { $id_gift = intval($this->input->post('id_gift', 0)); $giftdata = $this->mod_io_m->init('id_gift', $id_gift, TBL_GIFT); if ($giftdata) { $image = $giftdata->image; } else { $image = ''; } $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . 'gift/'; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . 'gift/'; $thumb_height = 60; $thumb_width = 60; if (isset($_FILES["image"]) and !empty($_FILES["image"]['name'])) { if ($_FILES["image"]['size'] / 1000000 > allowMaxFileSize()) { $image = ''; } else { $image = $this->module_helper->uploadFile($_FILES["image"]['tmp_name'], $_FILES["image"]['name'], $uploadDir, allowExtensionPictureUpload()); } } if (!$image) { echo 'Image must not empty'; exit; } else { copy($uploadDir . $image, $thumbnailDir . $image); makeThumb($image, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $image; } if (!$this->phpvalidator->is_numeric($this->input->post('price'))) { echo 'Price must be numeric.'; exit; } else { $data['price'] = $this->input->post('price'); } if ($this->input->post('name_gift')) { $data['name_gift'] = $this->input->post('name_gift'); $data['code_gift'] = slugify($this->input->post('name_gift')); } $data['ip'] = $this->geo_lib->getIpAddress(); $data['description'] = $this->input->post('description'); $data['id_category'] = $this->input->post('category'); $data['status'] = $this->input->post('status'); if ($giftdata) { $data['last_update'] = mysqlDate(); $this->mod_io_m->update_map($data, array('id_gift' => $id_gift), TBL_GIFT); } else { $data['add_date'] = mysqlDate(); $this->mod_io_m->insert_map($data, TBL_GIFT); } echo 'ok'; $this->session->set_flashdata('success', lang('templates.tmpl_save_success')); exit; }
function saveSeries() { $id_series = $this->input->post('id_series'); $seriesdata = $this->mod_io_m->init('id_series', $id_series, TBL_SERIES); $data['id_hentai_category'] = $this->input->post('id_hentai_category'); if ($data['id_hentai_category'] == 1) { //facebook $data['img_url'] = $this->input->post('img_url'); } else { $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . 'hentai/'; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . 'hentai/dailymotion/'; $thumb_height = 160; $thumb_width = 120; if ($seriesdata) { $image = $seriesdata->image . '.jpg'; } else { $image = ''; } if (isset($_FILES["image"]) and !empty($_FILES["image"]['name'])) { if ($_FILES["image"]['size'] / 1000000 > allowMaxFileSize()) { $image = ''; } else { $image = $this->module_helper->uploadFile($_FILES["image"]['tmp_name'], $_FILES["image"]['name'], $uploadDir, array('jpg')); } } if ($image) { copy($uploadDir . $image, $thumbnailDir . $image); makeThumb($image, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = substr($image, 0, strrpos($image, '.')); } } $data['name'] = $this->input->post('name'); if ($seriesdata) { $this->mod_io_m->update_map($data, array('id_series' => $id_series), TBL_SERIES); } else { $this->mod_io_m->insert_map($data, TBL_SERIES); } echo 'ok'; $this->session->set_flashdata('success', lang('templates.tmpl_save_success')); exit; }
function pictureHandling($id, $picture) { if ($picture == NULL) { return ""; } // No file uploaded //echo 'valid picture <br />'; if ($picture['size'] == 0) { echo "Problem: uploaded file is zero length"; return ""; } if ($picture['type'] != "image/jpeg" && $picture['type'] != "image/jpg" && $picture['type'] != "image/png" && $picture['type'] != "image/gif") { echo "Problem: file is not a proper png, gif, jpg, or jpeg"; return ""; } if (!is_uploaded_file($picture['tmp_name'])) { echo "Problem: possible file upload attack"; return ""; } $upfile = picName($id, $picture['name']); $thumb = thumbName($id); if (USING_AWS) { $client = S3Client::factory(array('key' => AWS_ACCESS_KEY, 'secret' => AWS_SECRET_KEY)); } if (!move_uploaded_file($picture['tmp_name'], $upfile)) { echo "Problem: Could not move picture into pictures directory"; return ""; } else { if (USING_AWS) { $key = $upfile; $result = $client->putObject(array('Bucket' => AWS_BUCKET, 'Key' => $key, 'Body' => file_get_contents($upfile), 'ContentDisposition' => 'inline')); } } makeThumb($upfile, $thumb); if (USING_AWS) { $key = $thumb; $result = $client->putObject(array('Bucket' => AWS_BUCKET, 'Key' => $key, 'Body' => file_get_contents($key), 'ContentDisposition' => 'inline')); } return $upfile; }
function submitSnapshotWebcam() { $title = $this->input->post('title'); $myPhoto = $this->input->post('image_name'); $price = round($this->input->post('price'), 2); if (!$price or $price <= 0) { echo json_encode(array('result' => 'error', 'message' => 'Price must greater than 0.')); exit; } $webcamDir = APP_ROOT . "webcamtemp/"; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; if (!$myPhoto) { echo json_encode(array('result' => 'error', 'message' => 'Upload picture failure.')); exit; } else { copy($webcamDir . $myPhoto, $thumbnailDir . $myPhoto); copy($webcamDir . $myPhoto, $uploadDir . $myPhoto); //chmod( $thumbnailDir.$myPhoto, 0777 ); //chmod( $uploadDir.$myPhoto, 0777 ); makeThumb($myPhoto, $uploadDir, $orig_width, $orig_height); makeThumb($myPhoto, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $myPhoto; $data['id_user'] = getAccountUserId(); $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['private']; $data['price'] = $price; $data['comment'] = $title; $data['prof_flag'] = 0; $data['v_count'] = 0; $data['rate_num'] = 0; $data['rating'] = 0; $data['added_date'] = mysqlDate(); $id_photo = $this->gallery_io_m->insert_map($data); $array['id_parent'] = 0; $array['id_user'] = getAccountUserId(); $array['description'] = "priced at {$price}J\$"; $array['add_date_post'] = mysqlDate(); $array['post_name'] = getAccountUserId() . '_' . filterCharacter($title); $array['post_id'] = $id_photo; $array['post_code'] = $GLOBALS['global']['CHATTER_CODE']['backstage_photo']; $id_wall = $this->mod_io_m->insert_map($array, TBL_WALL); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_BACKSTAGE_PHOTO); $_SESSION['BACKSTAGE_PRICE'] = $price; echo json_encode(array('result' => 'ok', 'message' => 'Upload your backstage photo successfully.')); exit; } echo 'Unknown error'; exit; }
//一页显示信息数 $page = isset($page) ? max(1, intval($page)) : 1; //处理页码变量 $offset = ($page - 1) * $pagesize; //偏移量 $dataarray = $Table->getdata("{$offset},{$pagesize}", $wheresql, '', 'oid,goodsimg,orderimg'); //获取团购数据 $msg = "总共需要抓取图片:{$total}个<br/>"; if (!empty($dataarray)) { //抓取图片操作 foreach ($dataarray as $val) { //远程图本地化 if (!empty($val['goodsimg'])) { $tempimg = GetRemoteImage($val['goodsimg']); $thumbname = "../" . $tempimg['savepath'] . "_thumb_" . $tempimg['filename']; makeThumb("../" . $tempimg['filepath'], $thumbname); editstate($Table->table, "orderimg", "oid=" . $val['oid'], $tempimg['filepath']); //更改图片地址操作 $msg .= "更新订单ID:{$val['oid']} 图片地址成功<br/>"; } } $url = geturl(); $goto = url::replace($url, "page=" . ($page + 1), 0, 1); showmsg($msg, $goto); } else { showmsg("抓取完成!", "goodsimg_get.php"); } } else { //包含后台模板文件 include "tpl/goodsimg_get.htm"; }
function thumb() { $params = JComponentHelper::getParams('com_einsatzkomponente'); $input = JFactory::getApplication()->input; $cid = $input->post->get('cid', array(), 'array'); // Sanitize the input JArrayHelper::toInteger($cid); JToolBarHelper::title(JText::_('Thumbs erstellen'), 'weblinks.png'); JToolBarHelper::cancel(); $option = JFactory::getApplication()->input->getCmd('option'); // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $total = count($cid); if ($total > '15') { echo 'erforderliche PHP-Einstellungen wurden vorgenommen:<br/><br/>'; echo 'PHP memory_limit ' . ini_get("memory_limit") . ' geändert in '; @ini_set('memory_limit', '512M'); echo ini_get("memory_limit") . '<br/>'; echo 'PHP max_execution_time ' . ini_get("max_execution_time") . ' geändert in '; @ini_set('max_execution_time', 600); echo ini_get("max_execution_time") . '<br/>'; } $uploadPath_thumb = $params->get('uploadpath', 'images/com_einsatzkomponente/einsatzbilder') . '/thumbs/'; $thumbwidth = $params->get('thumbwidth', '100'); $thumbhigh = $params->get('thumbhigh', '100'); $quadratisch = $params->get('quadratisch', 'true'); // make thumbs $n = '0'; $i = '0'; for ($i = 0; $i < $total; $i++) { $einsatzbild = einsatzbild($cid[$i]); // Funktion: zu bearbeitendes Einsatzbild laden $rImageFileName = $einsatzbild[0]->image; $source = JPATH_ROOT . '/' . $rImageFileName; $sourcename = basename($source); $sourcepath = str_replace($sourcename, "", $source); //$sourcepath = str_replace(JPATH_ROOT.'/', "", $sourcepath); $rThumbFileName = $uploadPath_thumb . $sourcename; $target = JPATH_ROOT . '/' . $rThumbFileName; if (file_exists($source)) { $n++; makeThumb($source, $thumbwidth, $thumbhigh, $quadratisch, 80, $target); // Funktion makeThumb aufrufen $db =& JFactory::getDBO(); $query = 'UPDATE `#__eiko_images` SET `thumb`="' . $rThumbFileName . '" WHERE id = "' . $cid[$i] . '"'; $db->setQuery($query); $db->query(); $msg = $n . JText::_('Thumb(s) erstellt'); } else { JFactory::getApplication()->enqueueMessage(JText::_('Das Einsatzbild "' . $source . '" existiert nicht !'), 'error'); } } //for $this->setRedirect('index.php?option=com_einsatzkomponente&view=einsatzbildmanager', $msg); // ### 110421 - }
function _resizePhoto() { //comment_thumb 40x40 //post_thumb 50x50 //profile_thumb 60x60 //thumb/photos 60x60 $arrayMIME = array('.jpg', '.png', '.jpeg'); $dirPath = "./image/comment_thumb/"; $i = 0; foreach (filesInDir($dirPath) as $file) { $ext_name_array = explode_name($file); if (in_array($ext_name_array['ext'], $arrayMIME)) { //chmod($dirPath.$file,777); $size = getimagesize($dirPath . $file); if ($size[0] > 40 or $size[1] > 40) { makeThumb($file, $dirPath, 40, 40); $i++; } } } echo "resize comment_thumb:{$i} items<br/>"; $dirPath = "./image/post_thumb/"; $i = 0; foreach (filesInDir($dirPath) as $file) { $ext_name_array = explode_name($file); if (in_array($ext_name_array['ext'], $arrayMIME)) { //chmod($dirPath.$file,777); $size = getimagesize($dirPath . $file); if ($size[0] > 50 or $size[1] > 50) { makeThumb($file, $dirPath, 50, 50); $i++; } } } echo "resize post_thumb:{$i} items<br/>"; $dirPath = "./image/profile_thumb/"; $i = 0; foreach (filesInDir($dirPath) as $file) { $ext_name_array = explode_name($file); if (in_array($ext_name_array['ext'], $arrayMIME)) { //chmod($dirPath.$file,777); $size = getimagesize($dirPath . $file); if ($size[0] > 60 or $size[1] > 60) { makeThumb($file, $dirPath, 60, 60); $i++; } } } echo "resize profile_thumb:{$i} items<br/>"; $dirPath = "./image/thumb/photos/"; $i = 0; foreach (filesInDir($dirPath) as $file) { $ext_name_array = explode_name($file); if (in_array($ext_name_array['ext'], $arrayMIME)) { //chmod($dirPath.$file,777); $size = getimagesize($dirPath . $file); if ($size[0] > 60 or $size[1] > 60) { makeThumb($file, $dirPath, 60, 60); $i++; } } } echo "resize thumb/photos:{$i} items<br/>"; }
function thumbnailParse($parseDir = "./", $recurse = TRUE) { global $scriptPath, $dir; # Add trailing slash. $parseDir = fixDir($parseDir); # Remove the script path from the directory. # If the script is called as ./ and the $parseDir is ./, it leaves $scriptPath as ./ and $parseDir as "" # If the script is called as /home/<user>/host.com/ and $parseDir is /home/<user>/host.com/pictures/ $parseDir is pictures/ so that /home/<user>/host.com/cache/pictures can be created. $parseDir = str_replace($scriptPath, "", $parseDir); # Get list of folders & images $dir = $parseDir; $folder_scan_results = folder_scan(); $images = $folder_scan_results['images']; $movies = $folder_scan_results['movies']; $directories = $folder_scan_results['directories']; # foreach ($images as $image) { if (!is_file($scriptPath . 'cache/' . $dir . 'preview/' . $image)) { echo "Creating: {$dir}{$image} preview\n"; makeThumb($dir, $image, 1); } if (!is_file($scriptPath . 'cache/' . $dir . 'gallery/' . $image)) { echo "Creating: {$dir}{$image} gallery\n"; makeThumb($dir, $image, 2); } } foreach ($movies as $movie) { movie_info($movie); } if (count($directories) > 0 && $recurse === TRUE) { foreach ($directories as $file) { thumbnailParse($parseDir . $file); } } }
function submitSnapshotWebcam() { $title = $this->input->post('title'); $myPhoto = $this->input->post('image_name'); $webcamDir = APP_ROOT . "webcamtemp/"; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; if (!$myPhoto) { echo "Upload picture failure."; exit; } else { copy($webcamDir . $myPhoto, $thumbnailDir . $myPhoto); copy($webcamDir . $myPhoto, $uploadDir . $myPhoto); //chmod( $thumbnailDir.$myPhoto, 0777 ); //chmod( $uploadDir.$myPhoto, 0777 ); makeThumb($myPhoto, $uploadDir, $orig_width, $orig_height); makeThumb($myPhoto, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $myPhoto; $data['id_user'] = getAccountUserId(); $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['public']; $data['price'] = 0; $data['comment'] = $title; $data['prof_flag'] = 0; $data['v_count'] = 0; $data['rate_num'] = 0; $data['rating'] = 0; $data['added_date'] = mysqlDate(); $this->gallery_io_m->insert_map($data); echo json_encode(array('result' => 'ok', 'message' => 'Upload your snapshot successfully.')); exit; } echo 'Unknown error'; exit; }
function pippin_related_posts($taxonomy = '') { //affichage d'autres post en rapport en fonction de la taxo global $post; if ($taxonomy == '') { $taxonomy = 'post_tag'; } $tags = wp_get_post_terms($post->ID, $taxonomy); if ($tags) { $first_tag = $tags[0]->term_id; $second_tag = $tags[1]->term_id; $third_tag = $tags[2]->term_id; $args = array('post_type' => get_post_type($post->ID), 'posts_per_page' => 4, 'post__not_in' => array($post->ID), 'tax_query' => array('relation' => 'OR', array('taxonomy' => $taxonomy, 'terms' => $second_tag, 'field' => 'id', 'operator' => 'IN'), array('taxonomy' => $taxonomy, 'terms' => $first_tag, 'field' => 'id', 'operator' => 'IN'), array('taxonomy' => $taxonomy, 'terms' => $third_tag, 'field' => 'id', 'operator' => 'IN'))); $related = get_posts($args); if ($related) { $temp_post = $post; $content .= '<div class="relatedItems pippin">'; foreach ($related as $post) { setup_postdata($post); echo '<div class="row ">'; makeThumb($post->ID, "moyen", 12); echo '</div>'; } $post = $temp_post; } } }
} $descriptive_info = array($subject, $place, $date, $description, $groupID); $valid_formats = array("jpeg", "jpg", "gif"); // Code based from http://techstream.org/Web-Development/PHP/Multiple-File-Upload-with-PHP-and-MySQL if (isset($_FILES['images'])) { foreach ($_FILES['images']['tmp_name'] as $key => $tmp_name) { $file_name = $key . $_FILES['images']['name'][$key]; $file_size = $_FILES['images']['size'][$key]; $file_ext = strtolower(end(explode('.', $_FILES['image']['name'][$key]))); if (in_array($file_ext, $valid_formats) == false) { $errors[] = "Invalid Image Format"; } // Get a unique photo ID $uniq_photo_id = genUniqId($newDB); // Get the resized thumbnail of the image $thumbnail_blob = makeThumb($_FILES['images']['tmp_name'][$key], $_FILES['images']['type'][$key]); // Insert the image into the database insertImage($newDB->getConnection(), $uniq_photo_id, $username, $descriptive_info, file_get_contents($thumbnail_blob), file_get_contents($_FILES['images']['tmp_name'][$key])); } } // Close this connection $newDB->disconnect(); // Jump to upload page and report success $_SESSION["success"] = 'successuploaded'; header("Location: uploadForm.php"); // This function inserts the image and it's descriptive information into the database function insertImage($conn, $photo_id, $owner_name, $descriptive_info, $thumbnail, $photo) { $photo_blob = oci_new_descriptor($conn, OCI_D_LOB); $thumbnail_blob = oci_new_descriptor($conn, OCI_D_LOB); $subject = $descriptive_info[0];
function submitShareStatusSnapshotWC() { $photo = $this->input->post('image_name'); $desc = $this->input->post('status'); $webcamDir = APP_ROOT . "webcamtemp/"; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; copy($webcamDir . $photo, $thumbnailDir . $photo); copy($webcamDir . $photo, $uploadDir . $photo); //chmod( $thumbnailDir.$photo, 0777 ); //chmod( $uploadDir.$myPhoto, 0777 ); makeThumb($photo, $uploadDir, $orig_width, $orig_height); makeThumb($photo, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $photo; $data['id_user'] = getAccountUserId(); $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['public']; $data['price'] = 0; $data['comment'] = $desc; $data['prof_flag'] = 0; $data['v_count'] = 0; $data['rate_num'] = 0; $data['rating'] = 0; $data['added_date'] = mysqlDate(); $id_photo = $this->gallery_io_m->insert_map($data); $array['id_parent'] = 0; $array['id_user'] = getAccountUserId(); $array['description'] = substr($desc, 0, $GLOBALS['global']['INPUT_LIMIT']['wall_status']); $array['add_date_post'] = mysqlDate(); $array['post_id'] = $id_photo; $array['image'] = $photo; $this->mod_io_m->insert_map($array, TBL_WALL); echo json_encode(array('result' => 'ok', 'message' => 'Share your snapshot successfully.')); exit; }
function transferPicturesFromFaceBookToJuzon($id_user) { $picturelist = $this->getPicturesInSequence(); $x = 0; while ($picturelist[$x] != NULL) { echo $picturelist[$x]; $picture = @file_get_contents($picturelist[$x]); $temp_image_name = $this->savePicture($picture); ////////////////////////////////////////// $data['id_user'] = $id_user; $data['image_type'] = '0'; $data['price'] = ''; $data['comment'] = 'from Facebook'; $randomnumber = rand(1, 999999999); $imagename = 'facebook_' . $randomnumber . '.jpg'; $image = $id_user . '_' . $img_id . '_' . $imagename; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; //change the url format of picture $modified_cam_url = $temp_image_name; if (PHP_OS == 'Windows') { $modified_cam_url = str_replace("/", "\\", $modified_cam_url); } else { //for linux $modified_cam_url = str_replace("\\\\", "\\", $modified_cam_url); } $file_tmp = $modified_cam_url; chmod($file_tmp, 0777); $is_copied = copy($file_tmp, $uploadDir . $image); //delete temp file if ($is_copied) { // unlink($file_tmp); } chmod($uploadDir . $image, 0777); makeThumb($image, $uploadDir, $orig_width, $orig_height); makeThumb($image, $thumbnailDir, $thumb_width, $thumb_height); if ($is_copied) { $data['image'] = $image; $this->CI->gallery_io_m->insert_map($data); //return $img_id; } $x++; } }
function imageUpload($source, $destination, $thumb_destination) { if (checkSize($source)) { makeThumb($source, $thumb_destination); } if (move_uploaded_file($source, $destination)) { return true; } else { return false; } }
if (!empty($_GET)) { if (count($_GET) == 1 && '' == reset($_GET) && !isset($_GET['ext'])) { $fileName = urldecode($_SERVER['QUERY_STRING']); $file = fileFactory($fileName, $content); if (!in_array($fileName, $content) || !$file->isDimensional) { header('Location: ?'); } } elseif (isset($_GET['thumb'])) { if (!in_array($_GET['thumb'], $content)) { header('HTTP/1.1 404 Not Found'); exit(0); } $fullPath = DIRNAME . $_GET['thumb']; $thumbPath = DIRNAME . 'thumbs/' . getThumbName($_GET['thumb']); if (!file_exists($thumbPath)) { makeThumb($fullPath, $thumbPath); } header('Content-type: image/jpeg'); if (file_exists($thumbPath)) { header('Location: thumbs/' . getThumbName($_GET['thumb'])); // header('Expires: ' . date('r', time() + 60 * 60 * 24 * 365)); // 1 year cache // $handle = fopen($thumbPath, 'rb'); // echo fread($handle, filesize($thumbPath)); // fclose($handle); } else { $string = '/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAWgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQAAQEBAQEBAQEBAQIBAQECAgIBAQICAgICAgICAgM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RDiSZZTOApG87saQA1tjfFwVLvhrYzSvyffZAjwHATOA+jY3N0Xm8WtNXsa92Rhiobfut9vlTtvSaenYqA20w3YKupUpRceHzoSCInVIJIOwD88B//2Q=='; echo base64_decode($string); } exit(0); break; }
function changeProfileImage($id_user, $img_id) { $thumbDir = APP_ROOT . $GLOBALS['global']['PROF_IMAGE']['profile_thumb']; $chatterDir = APP_ROOT . $GLOBALS['global']['PROF_IMAGE']['profile_chatter']; $commDir = APP_ROOT . $GLOBALS['global']['PROF_IMAGE']['profile_comm']; $thumb_height = $GLOBALS['global']['PROF_IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['PROF_IMAGE']['thumb_width']; $chatter_height = $GLOBALS['global']['PROF_IMAGE']['chatter_height']; $chatter_width = $GLOBALS['global']['PROF_IMAGE']['chatter_width']; $comm_height = $GLOBALS['global']['PROF_IMAGE']['comm_height']; $comm_width = $GLOBALS['global']['PROF_IMAGE']['comm_width']; $userobjdata = $this->CI->user_io_m->init('id_user', $id_user); $prev_img = $userobjdata->photo; if ($prev_img) { //unlink($thumbDir.$prev_img); //unlink($chatterDir.$prev_img); //unlink($commDir.$prev_img); } $imgtype = $GLOBALS['global']['IMAGE_STATUS']['public']; $this->CI->db->query(" UPDATE " . TBL_GALLERY . " SET prof_flag=2 WHERE prof_flag=1 AND id_user={$id_user} AND image_type={$imgtype}"); $res = $this->CI->db->query(" SELECT * FROM " . TBL_GALLERY . " WHERE id_image={$img_id} AND image_type={$imgtype} LIMIT 1")->result(); if ($res and $res[0]->id_wall) { $galleryDir = APP_ROOT . $GLOBALS['global']['IMAGE']['wall_image_orig']; $file_name = explode('_', $res[0]->image, 2); $filename = $id_user . "_" . $img_id . "_" . $file_name[1]; } else { $galleryDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $filename = $res[0]->image; } $photo['photo'] = $filename; $this->CI->user_io_m->update_map($photo, $id_user); $this->CI->db->query(" UPDATE " . TBL_GALLERY . " SET prof_flag=1 WHERE id_image={$img_id} AND image_type={$imgtype}"); copy($galleryDir . $res[0]->image, $thumbDir . $filename); makeThumb($filename, $thumbDir, $thumb_width, $thumb_height); copy($galleryDir . $res[0]->image, $chatterDir . $filename); makeThumb($filename, $chatterDir, $chatter_width, $chatter_height); copy($galleryDir . $res[0]->image, $commDir . $filename); makeThumb($filename, $commDir, $comm_width, $comm_height); }
function importImage($_path, $_fileName, $_folderId) { $coords = extractGps($_path . '/' . $_fileName); $exifDatas = readExifFromFile($_path . '/' . $_fileName); $date_crea = ''; $iso = 0; $aperture = ''; $exposure = ''; if (isset($exifDatas['DateTimeOriginal'])) { $date_crea = $exifDatas['DateTimeOriginal']; $date_crea = explode(' ', $date_crea); $date_crea[0] = str_replace(':', '-', $date_crea[0]); $date_crea = $date_crea[0] . ' ' . $date_crea[1]; } if (isset($exifDatas['ISOSpeedRatings'])) { $iso = $exifDatas['ISOSpeedRatings']; } if (isset($exifDatas['ApertureValue'])) { $aperture = $exifDatas['ApertureValue']; } if (isset($exifDatas['ExposureTime'])) { $exposure = $exifDatas['ExposureTime']; } $sql = 'INSERT INTO files (folder_id, path, filename, lat, lon, exif_date_crea, exif_iso, exif_aperture, exif_exposure_time) VALUES(' . $_folderId . ', "' . clean_champ($_path) . '", "' . clean_champ($_fileName) . '", ' . $coords['lat'] . ', ' . $coords['lon'] . ', "' . $date_crea . '", ' . $iso . ', "' . $aperture . '", "' . $exposure . '")'; mysql_query($sql); $imageId = mysql_insert_id(); makeThumb($imageId, $_path . '/' . $_fileName, 'h', 200, dirname(__FILE__) . '/../thumbs/' . $_folderId); importImageTags($_path . '/' . $_fileName); linkImageTags($imageId); return $imageId; }
function drUpload() { // Allow access to the global (scope) variables. global $drNotice, $error, $truTarget, $druTarget, $uFileName; // Generate the 40-bit SHA1 file hash for simple dup lookup. $shaHash = sha1_file($truTarget . $uFileName); // Retrieve the MD5 fingerprint for storage in the database. $md5Fingerprint = createFingerprint($truTarget . $uFileName); // Make sure we aren't accidentally overwriting anything this time. if (file_exists($druTarget . $uFileName)) { // Upload will cause more than one file with the same name in the directory? Error. $error = '<p><strong>ERROR:</strong> Filename uniqueness not preserved.<br />Please try again or contact the webmaster if this problem persists.</p>'; } else { // Uniqueness check... $dupResponse = simpleDupCheck($truTarget . $uFileName, $shaHash, $druTarget, $md5Fingerprint); if ($dupResponse !== null) { // Every image gets a new handle, even if it's in the reduced folder. (For consistency) $newiHandle = createImageHandle(6); try { // Exact dup found, add to DB and respond appropriately. $stmt = $GLOBALS["conn"]->prepare('INSERT INTO share_tracker (ILookup, IName, directory, uMethod) VALUES (:imageHandle,:imageName,:directory,:uMethod)'); $stmt->execute(array(':imageHandle' => $newiHandle, ':imageName' => $dupResponse, ':directory' => 'uploads_reduced', ':uMethod' => '1')); // Report back a success! $drNotice = "<p><strong>NOTICE:</strong> Image was not added to duplicate reduced directory, file already exists.</p>" . "<br />" . "<p>To share your image, use the following link: " . "<a href=\"http://skynetgds.no-ip.biz/srthesis/irc.php?view={$newiHandle}\">http://skynetgds.no-ip.biz/srthesis/irc.php?view={$newiHandle}</a></p>"; } catch (PDOException $e) { // Or a failure... $error = '<p><strong>ERROR:</strong> ' . $e->getMessage() . '</p>'; } // Unique so actually upload the file! } else { // Create an image handle for the duplicate reduced link. $drImageHandle = createImageHandle(6); // Globally rename the file using this original filename. $relinkFileName = renameFile($uFileName, $drImageHandle); // Copy image to dup reduced and see if success. if (copy($truTarget . $uFileName, $druTarget . $relinkFileName)) { // Create a thumbnail for lightweight public viewing. makeThumb($druTarget, $GLOBALS["publicThumbTarget"], $relinkFileName, $GLOBALS["publicThumbSize"]); try { // Add the image to the database! $stmt = $GLOBALS["conn"]->prepare('INSERT INTO share_tracker (ILookup, IName, directory, uMethod, hash, fingerprint) VALUES (:imageHandle,:imageName,:directory,:uMethod, :shaHash, :fingerprint)'); $stmt->execute(array(':imageHandle' => $drImageHandle, ':imageName' => $relinkFileName, ':directory' => 'uploads_reduced', ':uMethod' => '1', ':shaHash' => $shaHash, ':fingerprint' => $md5Fingerprint)); // Report a success! $drNotice = "<p><strong>NOTICE:</strong> The image was unique and added to duplicate reduced directory!</p>" . "<br />" . "<p>To share your image, use the following link: " . "<br />" . "<a href=\"http://skynetgds.no-ip.biz/srthesis/irc.php?view={$drImageHandle}\">http://skynetgds.no-ip.biz/srthesis/irc.php?view={$drImageHandle}</a></p>"; } catch (PDOException $e) { // Or a failure... $error = '<p><strong>ERROR:</strong> ' . $e->getMessage() . '</p>'; } } else { $error = '<p><strong>ERROR!</strong> File could not be saved to the server.<br />Please retry or contact the webmaster if this problem persists.</p>'; } } } }
function addExif($filename, $exifdata) { try { $jpeg = new PelJpeg($filename); if (!($exif = $jpeg->getExif())) { // Create and add empty Exif data to the image (this throws away any old Exif data in the image). $exif = new PelExif(); $jpeg->setExif($exif); } if (!($tiff = $exif->getTiff())) { // Create and add TIFF data to the Exif data (Exif data is actually stored in a TIFF format). $tiff = new PelTiff(); $exif->setTiff($tiff); } if (!($ifd0 = $tiff->getIfd())) { // Create first Image File Directory and associate it with the TIFF data. $ifd0 = new PelIfd(PelIfd::IFD0); $tiff->setIfd($ifd0); } if (!($exif_ifd = $ifd0->getSubIfd(PelIfd::EXIF))) { // Create first Image File Directory and associate it with the TIFF data. $exif_ifd = new PelIfd(PelIfd::EXIF); $ifd0->addSubIfd($exif_ifd); } if (!($ifd1 = $ifd0->getNextIfd())) { // thumbnail does not exist $ifd1 = new PelIfd(1); $ifd0->setNextIfd($ifd1); $original = ImageCreateFromString($jpeg->getBytes()); # create image resource of original $thumb = makeThumb($original); // start writing output to buffer ob_start(); // outputs thumb resource contents to buffer ImageJpeg($thumb); // create PelDataWindow from buffer thumb contents (and end output to buffer) $window = new PelDataWindow(ob_get_clean()); if ($window) { $ifd1->setThumbnail($window); # set window data as thumbnail in ifd1 } imagedestroy($original); imagedestroy($thumb); } foreach ($exifdata as $PelTag => $val) { if ($PelTag == PelTag::USER_COMMENT) { if (!($entry = $exif_ifd->getEntry($PelTag))) { $exif_ifd->addEntry(new PelEntryUserComment($val)); } else { $entry->setValue($val); } } else { if (!($entry = $ifd0->getEntry($PelTag))) { $ifd0->addEntry(new PelEntryAscii($PelTag, $val)); } else { $entry->setValue($val); } } } $jpeg->saveFile($filename); return true; } catch (Exception $e) { // Handle exception echo $e; } }