썸네일 파일 jpg로 변경

This commit is contained in:
chicpro
2013-02-21 16:06:47 +09:00
parent e25af3e437
commit 58c8f60409

View File

@ -98,7 +98,7 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
@chmod($target_path, 0707);
}
$thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.png";
$thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.jpg";
$thumb_time = @filemtime($thumb_file);
$source_file = "$source_path/$filename";
$source_time = @filemtime($source_file);
@ -112,7 +112,7 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
// 이미지 파일이 없거나 아님
if (!$size[0]) {
if (!$thumb_height) $thumb_height = $thumb_width;
$thumb_file = "$target_path/thumb-noimg_{$thumb_width}x{$thumb_height}.png";
$thumb_file = "$target_path/thumb-noimg_{$thumb_width}x{$thumb_height}.jpg";
if (!file_exists($thumb_file)) {
$target = imagecreate($thumb_width, $thumb_height);
imagecolorallocate($target, 250, 250, 250);
@ -162,7 +162,8 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
}
}
imagepng($dst, $thumb_file, 0); // 0 (no compression) ~ 9
//imagepng($dst, $thumb_file, 9); // 0 (no compression) ~ 9
imagejpeg($dst, $thumb_file, 90);
chmod($thumb_file, 0606); // 추후 삭제를 위하여 파일모드 변경
return basename($thumb_file);