changes for FS#145
This commit is contained in:
parent
7f51b1035d
commit
8797b3820e
@ -1110,6 +1110,8 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
case CPM_SCALE_NONE:
|
||||
return null;
|
||||
case CPM_SCALE_IMAGEMAGICK:
|
||||
$original_size = getimagesize($input);
|
||||
|
||||
$unique_colors = exec("identify -format '%k' '${input}'");
|
||||
if (empty($unique_colors)) { $unique_colors = 256; }
|
||||
|
||||
@ -1119,6 +1121,7 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
? $cpm_config->properties["${type}_comic_width"]
|
||||
: $cpm_config->properties['archive_comic_width'];
|
||||
|
||||
if ($width_to_use < $original_size[0]) {
|
||||
$command = array("convert",
|
||||
"\"${input}\"",
|
||||
"-filter Lanczos",
|
||||
@ -1156,6 +1159,9 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
@chmod($target, CPM_FILE_UPLOAD_CHMOD);
|
||||
$files_created_in_operation[] = $target;
|
||||
}
|
||||
} else {
|
||||
copy($input, $target);
|
||||
}
|
||||
}
|
||||
|
||||
return ($ok) ? $files_created_in_operation :false ;
|
||||
@ -1197,6 +1203,7 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
? $cpm_config->properties["${type}_comic_width"]
|
||||
: $cpm_config->properties['archive_comic_width'];
|
||||
|
||||
if ($width_to_use < $width) {
|
||||
$archive_comic_height = (int)(($width_to_use * $height) / $width);
|
||||
|
||||
$pathinfo = pathinfo($input);
|
||||
@ -1277,6 +1284,9 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
copy($input, $target);
|
||||
}
|
||||
|
||||
if (!file_exists($target)) {
|
||||
$ok = false;
|
||||
|
@ -173,9 +173,12 @@ function cpm_build_comic_uri($filename, $base_dir = null) {
|
||||
function cpm_breakdown_comic_filename($filename, $allow_override = false) {
|
||||
$pattern = CPM_DATE_FORMAT;
|
||||
if ($allow_override !== false) {
|
||||
if (is_string($allow_override)) {
|
||||
$pattern = $allow_override;
|
||||
} else {
|
||||
if (isset($_POST['upload-date-format']) && !empty($_POST['upload-date-format'])) { $pattern = $_POST['upload-date-format']; }
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array('[0-9]{4}', '[0-9]{2}') as $year_pattern) {
|
||||
$new_pattern = cpm_transform_date_string($pattern, array("Y" => $year_pattern,
|
||||
|
Loading…
Reference in New Issue
Block a user