コード例 #1
0
ファイル: editphoto.php プロジェクト: BackupTheBerlios/soopa
     // remove old file.
     $prs = $xoopsDB->query("SELECT ext FROM {$table_photos} WHERE lid={$lid}");
     list($ext) = $xoopsDB->fetchRow($prs);
     @unlink("{$photos_dir}/{$lid}.{$ext}");
     @unlink("{$thumbs_dir}/{$lid}.{$ext}");
     @unlink("{$thumbs_dir}/{$lid}.gif");
     // The original file name will be the title if title is empty
     if (trim($_POST["title"]) === "") {
         $_POST['title'] = $uploader->getMediaName();
     }
     $title = $myts->stripSlashesGPC($_POST["title"]);
     $desc_text = $myts->stripSlashesGPC($_POST["desc_text"]);
     $date = time();
     $tmp_name = $uploader->getSavedFileName();
     $ext = substr(strrchr($tmp_name, '.'), 1);
     myalbum_modify_photo("{$photos_dir}/{$tmp_name}", "{$photos_dir}/{$lid}.{$ext}");
     $dim = GetImageSize("{$photos_dir}/{$lid}.{$ext}");
     if (!$dim) {
         $dim = array(0, 0);
     }
     if (!myalbum_create_thumb("{$photos_dir}/{$lid}.{$ext}", $lid, $ext)) {
         $xoopsDB->query("DELETE FROM {$table_photos} WHERE lid='{$lid}'");
         redirect_header('editphoto.php?lid=$lid', 10, _ALBM_FILEERROR);
         exit;
     }
     myalbum_update_photo($lid, $cid, $title, $desc_text, $valid, $ext, $dim[0], $dim[1]);
     exit;
 } else {
     $uploader->getErrors(true);
     include_once "../../header.php";
     OpenTable();
コード例 #2
0
ファイル: submit_block.php プロジェクト: severnaya99/Sg-2010
 $photo['description'] = $myts->stripSlashesGPC($_POST["desc_text"]);
 $photo['title'] = $myts->stripSlashesGPC($_POST["title"]);
 $photo['cid'] = empty($_POST['cid']) ? 0 : intval($_POST['cid']);
 $field = $_POST['xoops_upload_file'][0];
 if (is_readable($_FILES[$field]['tmp_name'])) {
     // new preview
     if ($myalbum_canresize) {
         $uploader = new MyXoopsMediaUploader($photos_dir, $array_allowed_mimetypes, $myalbum_fsize, null, null, $array_allowed_exts);
     } else {
         $uploader = new MyXoopsMediaUploader($photos_dir, $array_allowed_mimetypes, $myalbum_fsize, $myalbum_width, $myalbum_height, $array_allowed_exts);
     }
     $uploader->setPrefix('tmp_');
     if ($uploader->fetchMedia($field) && $uploader->upload()) {
         $tmp_name = $uploader->getSavedFileName();
         $preview_name = str_replace('tmp_', 'tmp_prev_', $tmp_name);
         myalbum_modify_photo("{$photos_dir}/{$tmp_name}", "{$photos_dir}/{$preview_name}");
         list($imgsrc, $width_spec, $ahref) = myalbum_get_img_attribs_for_preview($preview_name);
     } else {
         @unlink($uploader->getSavedDestination());
         $imgsrc = "{$mod_url}/images/pixel_trans.gif";
         $width_spec = "width='{$myalbum_thumbsize}' height='{$myalbum_thumbsize}'";
         $ahref = '';
     }
 } else {
     if ($preview_name != '' && is_readable("{$photos_dir}/{$preview_name}")) {
         // old preview
         list($imgsrc, $width_spec, $ahref) = myalbum_get_img_attribs_for_preview($preview_name);
     } else {
         // preview without image
         $imgsrc = "{$mod_url}/images/pixel_trans.gif";
         $width_spec = "width='{$myalbum_thumbsize}' height='{$myalbum_thumbsize}'";
コード例 #3
0
ファイル: redothumbs.php プロジェクト: BackupTheBerlios/soopa
         myalbum_create_thumb("{$photos_dir}/{$lid}.{$ext}", $lid, $ext);
         echo _AM_MB_CREATEDTHUMBS . "<br />\n";
     } else {
         echo _AM_MB_SKIPPED . "<br />\n";
     }
     continue;
 }
 // Size of main photo
 list($true_w, $true_h) = getimagesize("{$photos_dir}/{$lid}.{$ext}");
 echo "{$true_w}x{$true_h} .. ";
 // Check and resize the main photo if necessary
 if ($resize && ($true_w > $myalbum_width || $true_h > $myalbum_height)) {
     $tmp_path = "{$photos_dir}/myalbum_tmp_photo";
     @unlink($tmp_path);
     rename("{$photos_dir}/{$lid}.{$ext}", $tmp_path);
     myalbum_modify_photo($tmp_path, "{$photos_dir}/{$lid}.{$ext}");
     @unlink($tmp_path);
     echo _AM_MB_PHOTORESIZED . " &nbsp; ";
     list($true_w, $true_h) = getimagesize("{$photos_dir}/{$lid}.{$ext}");
 }
 // Check and repair record of the photo if necessary
 if ($true_w != $w || $true_h != $h) {
     $xoopsDB->query("UPDATE {$table_photos} SET res_x={$true_w}, res_y={$true_h} WHERE lid={$lid}") or die("DB error: UPDATE photo table.");
     echo _AM_MB_SIZEREPAIRED . " &nbsp; ";
 }
 // Create Thumbs
 if (is_readable("{$thumbs_dir}/{$lid}.{$ext}")) {
     list($thumb_w, $thumb_h) = getimagesize("{$thumbs_dir}/{$lid}.{$ext}");
     echo "{$thumb_w}x{$thumb_h} ... ";
     if ($forceredo) {
         $retcode = myalbum_create_thumb("{$photos_dir}/{$lid}.{$ext}", $lid, $ext);