const CALENDAR_ICON_FILE = '/images/system/calendar.png'; // カレンダーアイコン
const ACTIVE_ICON_FILE = '/images/system/active32.png'; // 公開中アイコン
const INACTIVE_ICON_FILE = '/images/system/inactive32.png'; // 非公開アイコン
- const ICON_SIZE = 32; // アイコンのサイズ
- const LIST_ICON_SIZE = 64; // リスト用アイコンのサイズ
+ const ICON_SIZE = 32; // ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\82¢ã\82¤ã\82³ã\83³ã\81®ã\82µã\82¤ã\82º
+ const LIST_ICON_SIZE = 128; // 画像サムネールのサイズ
const DEFAULT_IMAGE_DIR = '/images'; // デフォルトの画像格納ディレクトリ
-// const PHOTO_DIR = '/etc/photo'; // マスター画像格納ディレクトリ
- const PHOTO_HOME_DIR = '/etc/photo/home'; // マスター画像格納ディレクトリ(ユーザ別)
+ const CACHE_DIR = '/.cache/images'; // 画像キャッシュディレクトリ
const DEFAULT_THUMBNAIL_SIZE = 128; // サムネール画像サイズ
const DEFAULT_IMAGE_EXT = 'jpg'; // 画像ファイルのデフォルト拡張子
const DEFAULT_IMAGE_TYPE = IMAGETYPE_JPEG;
$task = $request->trimValueOf('task');
$this->templateId = $request->trimValueOf(M3_REQUEST_PARAM_TEMPLATE_ID); // テンプレートIDを取得
+ // パラメータチェック
+ if (empty($this->templateId)){
+ $this->setAppErrorMsg('テンプレートIDが設定されていません');
+ return;
+ }
+
+ // 画像キャッシュディレクトリ作成
+ $cacheDir = $this->gEnv->getTemplatesPath() . '/' . $this->templateId . self::CACHE_DIR;
+ if (!is_dir($cacheDir)){
+ if (!mkdir($cacheDir, M3_SYSTEM_DIR_PERMISSION, true/*再帰的*/)){
+ $this->setAppErrorMsg('キャッシュディレクトリが作成できません');
+ }
+ }
+
switch ($task){
case 'tempimage':
default:
*/
function createList($request)
{
- // パラメータチェック
- if (empty($this->templateId)){
- $this->setAppErrorMsg('テンプレートIDが設定されていません');
- return;
- }
-
// 画像格納ディレクトリを取得
- $this->imageBasePath = $this->gEnv->getTemplatesPath() . '/' . $this->templateId . self::DEFAULT_IMAGE_DIR;
+ $this->imageBasePath = $this->gEnv->getTemplatesPath() . '/' . $this->templateId . self::DEFAULT_IMAGE_DIR;
if (!is_dir($this->imageBasePath)){
$this->setAppErrorMsg('画像ディレクトリが見つかりません。パス=' . $this->imageBasePath);
return;
$fileList = $this->getFileList($path);
$totalCount = count($fileList);
- // 表示するページ番号の修正
-/* $pageCount = (int)(($totalCount -1) / $viewCount) + 1; // 総ページ数
- if ($pageNo < 1) $pageNo = 1;
- if ($pageNo > $pageCount) $pageNo = $pageCount;
- $this->firstNo = ($pageNo -1) * $viewCount + 1; // 先頭番号
- $startNo = ($pageNo -1) * $viewCount +1; // 先頭の行番号
- $endNo = $pageNo * $viewCount > $totalCount ? $totalCount : $pageNo * $viewCount;// 最後の行番号
- */
// ページング計算
$this->calcPageLink($pageNo, $totalCount, $maxListCount);
$startNo = ($pageNo -1) * $maxListCount +1; // 先頭の行番号
$endNo = $pageNo * $maxListCount > $totalCount ? $totalCount : $pageNo * $maxListCount;// 最後の行番号
- // ページング用リンク作成
-/* $pageLink = '';
- if ($pageCount > 1){ // ページが2ページ以上のときリンクを作成
- for ($i = 1; $i <= $pageCount; $i++){
- if ($i == $pageNo){
- $link = ' ' . $i;
- } else {
- //$link = ' <a href="#" onclick="selpage(\'' . $i . '\');return false;">' . $i . '</a>';
- $relativePath = substr($path, strlen($this->imageBasePath));
- $pageUrl = $this->_baseUrl . '&task=imagebrowse&path=' . $relativePath;
- if ($i > 1) $pageUrl .= '&page=' . $i;
- $link = ' <a href="' . $this->convertUrlToHtmlEntity($this->getUrl($pageUrl)) . '">' . $i . '</a>';
- }
- $pageLink .= $link;
- }
- }*/
// ページングリンク作成
$relativePath = substr($path, strlen($this->imageBasePath));
$pageUrl = $this->_baseUrl . '&task=imagebrowse&path=' . $relativePath;
// $file = end(explode('/', $filePath)); // pathinfo,basenameは日本語処理できないので日本語対応
$filePathArray = explode('/', $filePath); // pathinfo,basenameは日本語処理できないので日本語対応
$file = end($filePathArray);
- $size = '';
+ $size = ''; // ファイルサイズ
$fileLink = '';
$filenameOption = ''; // ファイル名オプション
- $code = ''; // 画像コード
$checkDisabled = ''; // チェックボックス使用制御
- $statusImg = ''; // 状態
- $rating = ''; // 評価
+ $imageSize = '';
if (is_dir($filePath)){ // ディレクトリのとき
// アイコン作成
$iconUrl = $this->gEnv->getRootUrl() . self::FOLDER_ICON_FILE;
$checkDisabled = 'disabled '; // チェックボックス使用制御
}
$serial = -1;
-
- $totalViewCount = ''; // 総参照数
- } else { // 画像ファイルのとき
- // 画像情報取得
-// $ret = self::$_mainDb->getPhotoInfo($file, $this->_langId, $row, $categoryRows);
- if ($ret){
- $serial = $row['ht_serial'];
- $code = $row['ht_code']; // 画像コード
- $rating = $row['ht_rate_average']; // 評価
+ } else { // ファイルのとき
+ // 画像情報を取得
+ $isImageFile = false;
+ $imageSize = @getimagesize($filePath);
+ if ($imageSize){
+ $imageWidth = $imageSize[0];
+ $imageHeight = $imageSize[1];
+ $imageType = $imageSize[2];
+ $imageMimeType = $imageSize['mime']; // ファイルタイプを取得
- $filenameOption = '<br />元のファイル名: ' . $this->convertToDispString($row['ht_original_filename']); // ファイル名オプション
- $filenameOption .= '<br />タイトル名: ' . $this->convertToDispString($row['ht_name']); // タイトル名
- // $filenameOption .= '<br />カテゴリー: ' . $this->convertToDispString($categoryStr); // 所属カテゴリー
-
- // 使用限定ユーザの場合は、所有者でなければ削除できない
- if (self::$_isLimitedUser && $this->_userId != $row['ht_owner_id']){
- $checkDisabled = 'disabled '; // チェックボックス使用制御
- $serial = -1;
+ // 処理可能な画像ファイルタイプかどうか
+ if (in_array($imageMimeType, $this->permitMimeType)){
+ $isImageFile = true;
+ $imageSize = $imageWidth . 'x' . $imageHeight;
}
}
+
// ファイル削除用チェックボックス
//if (!$this->canDeleteFile || !is_writable($filePath)) $checkDisabled = 'disabled '; // チェックボックス使用制御
// $thumbnailPath = photo_mainCommonDef::getThumbnailPath($file);
+ // サムネール画像作成
+
// アイコン作成
$iconTitle = $this->convertToDispString($file);
- if (file_exists($thumbnailPath)){ // サムネールが存在する場合
+ if ($isImageFile){ // 画像ファイルの場合
// $iconUrl = photo_mainCommonDef::getThumbnailUrl($file);
$iconTag = '<a href="#" onclick="editItemBySerial(' . $serial . ');return false;">';
$iconTag .= '<img src="' . $this->getUrl($iconUrl) . '" width="' . self::LIST_ICON_SIZE . '" height="' . self::LIST_ICON_SIZE . '" rel="m3help" alt="' . $iconTitle . '" title="' . $iconTitle . '" />';
//$fileLink = $this->convertToDispString($file);
$fileLink = '<a href="#" onclick="editItemBySerial(' . $serial . ');return false;">' . $this->convertToDispString($file) . '</a>';
$size = filesize($filePath);
-
- // 総参照数
- //$totalViewCount = $this->gInstance->getAnalyzeManager()->getTotalContentViewCount(photo_mainCommonDef::REF_TYPE_CONTENT, $row['ht_id']);
- $totalViewCount = $row['ht_view_count'];
-
- // 公開状態
- $isActive = false; // 公開状態
- if ($row['ht_visible']) $isActive = true;// 表示可能
-
- if ($isActive){ // コンテンツが公開状態のとき
- $iconUrl = $this->gEnv->getRootUrl() . self::ACTIVE_ICON_FILE; // 公開中アイコン
-// $iconTitle = $this->_('Published');
- } else {
- $iconUrl = $this->gEnv->getRootUrl() . self::INACTIVE_ICON_FILE; // 非公開アイコン
-// $iconTitle = $this->_('Unpublished');
- }
- $statusImg = '<img src="' . $this->getUrl($iconUrl) . '" width="' . self::ICON_SIZE . '" height="' . self::ICON_SIZE . '" rel="m3help" alt="' . $iconTitle . '" title="' . $iconTitle . '" />';
}
// ファイル更新日時
'name' => $this->convertToDispString($file), // ファイル名
'filename' => $fileLink, // ファイル名
'filename_option' => $filenameOption, // ファイル名オプション
- 'code' => $this->convertToDispString($code), // 画像コード
+ 'image_size' => $imageSize, // 画像サイズ
'size' => $size, // ファイルサイズ
'date' => $updateDate, // 更新日時
- 'view_count' => $totalViewCount, // 総参照数
- 'rate' => $this->convertToDispString($rating), // 評価
- 'status' => $statusImg, // 公開状況
'check_disabled' => $checkDisabled, // チェックボックス使用制御
);
$this->tmpl->addVars('file_list', $row);
window.alert('{_LC_MSG_DIRECTORY_NOT_ALLOWED}');
return true;
}
- document.main.task.value = 'imagebrowse_detail';
+ document.main.task.value = 'tempimage_detail';
document.main.act.value = 'edit';
document.main.serial.value = items[i];
document.main.submit();
return true;
}
function editItemBySerial(serial){
- document.main.task.value = 'imagebrowse_detail';
+ document.main.task.value = 'tempimage_detail';
document.main.act.value = 'edit';
document.main.serial.value = serial;
document.main.submit();
<div class="m3config_container">
<!-- m3:ErrorMessage -->
<form method="post" name="main">
-<input type="hidden" name="task" value="imagebrowse" />
+<input type="hidden" name="task" value="tempimage" />
<input type="hidden" name="act" />
<input type="hidden" name="serial" />
<input type="hidden" name="seriallist" value="{SERIAL_LIST}" />
<input type="hidden" name="path" value="{PATH}" />
<input type="hidden" name="directory_name" />
-<h3 class="m3config_h" style="margin-right:20px;"><span {_HELP_IMAGEBROWSE_LIST}>画像一覧</span></h3><span {_HELP_IMAGEBROWSE_PATH}>{_LC_LABEL_PATH}</span>{PATH_LINK}
-<div class="m3config_h_side_buttons pull-right"><div {_HELP_IMAGEBROWSE_BUTTONS}><div class="btn-group">
+<h3 class="m3config_h" style="margin-right:20px;"><span {_HELP_TEMPIMAGE_LIST}>画像一覧</span></h3><span {_HELP_TEMPIMAGE_PATH}>{_LC_LABEL_PATH}</span>{PATH_LINK}
+<div class="m3config_h_side_buttons pull-right"><div {_HELP_TEMPIMAGE_BUTTONS}><div class="btn-group">
<input type="button" class="button" onclick="editItem();" value="{_LC_LABEL_EDIT}" /><input type="button" class="button" onclick="delItem();" value="{_LC_LABEL_DELETE}" {DEL_DISABLED}/>
</div></div></div>
<div class="m3config_h_side_buttons pull-right" style="margin-right:10px;">
-<div {_HELP_IMAGEBROWSE_BUTTONS2}><div class="btn-group">
+<div {_HELP_TEMPIMAGE_BUTTONS2}><div class="btn-group">
<input type="button" class="button" onclick="showFileUpload();" value="アップロード" /><a href="javascript:void(0);" id="createdirbutton" class="button" role="button" rel="m3help" data-container="body" title="ディレクトリを作成"><i class="glyphicon glyphicon-folder-close"></i></a>
</div></div></div>
<table id="mainconfig">
<thead>
<tr>
- <th class="select"><span {_HELP_IMAGEBROWSE_CHECK}>{_LC_LABEL_CHECK}</span></th>
+ <th class="select"><span {_HELP_TEMPIMAGE_CHECK}>{_LC_LABEL_CHECK}</span></th>
<th style="border-right:none;width:50px;"></th>
- <th style="border-left:none;width:300px;"><span {_HELP_IMAGEBROWSE_FILENAME}>{_LC_LABEL_FILENAME}</span></th>
- <th class="status"><span {_HELP_IMAGEBROWSE_STATUS}>{_LC_LABEL_STATUS}</span></th>
- <th width="10%"><span {_HELP_IMAGEBROWSE_IMAGE_CODE}>{_LC_LABEL_IMAGE_CODE}</span></th>
- <!--<th width="7%"><span {_HELP_IMAGEBROWSE_SIZE}>{_LC_LABEL_SIZE}</span></th>-->
- <th><span {_HELP_IMAGEBROWSE_VIEW_COUNT}>{_LC_LABEL_VIEW_COUNT}</span></th>
- <th class="status"><span {_HELP_IMAGEBROWSE_RATE}>{_LC_LABEL_RATE}</span></th>
- <th class="date_narrow"><span {_HELP_IMAGEBROWSE_DATE}>{_LC_LABEL_DATE}</span></th>
+ <th style="border-left:none;width:300px;"><span {_HELP_TEMPIMAGE_FILENAME}>{_LC_LABEL_FILENAME}</span></th>
+ <th><span {_HELP_TEMPIMAGE_IMAGE_SIZE}>画像サイズ(横x縦)</span></th>
+ <th><span {_HELP_TEMPIMAGE_FILE_SIZE}>サイズ(バイト)</span></th>
+ <th class="date_narrow"><span {_HELP_TEMPIMAGE_DATE}>{_LC_LABEL_DATE}</span></th>
</tr>
</thead>
<tbody>
<td><input type="checkbox" name="item{INDEX}_selected" {CHECK_DISABLED}/><input type="hidden" name="item{INDEX}_name" value="{NAME}" /></td>
<td style="border-right:none;text-align:center;">{ICON}</td>
<td style="border-left:none;">{FILENAME}{FILENAME_OPTION}</td>
- <td>{STATUS}</td>
- <td>{CODE}</td>
- <!--<td>{SIZE}</td>-->
- <td class="number">{VIEW_COUNT}</td>
- <td>{RATE}</td>
+ <td>{IMAGE_SIZE}</td>
+ <td>{SIZE}</td>
<td>{DATE}</td>
</tr>
</patTemplate:tmpl>