generate mini thumbs
This commit is contained in:
parent
c8e0e73000
commit
51817fa3b8
|
@ -425,7 +425,7 @@ function cpm_manage_posts_custom_column($column_name) {
|
||||||
$thumbnails_found = cpm_find_thumbnails_by_filename($file);
|
$thumbnails_found = cpm_find_thumbnails_by_filename($file);
|
||||||
|
|
||||||
$icon_file_to_use = $file;
|
$icon_file_to_use = $file;
|
||||||
foreach (array('rss', 'archive') as $type) {
|
foreach (array('rss', 'archive', 'mini') as $type) {
|
||||||
if (isset($thumbnails_found[$type])) { $icon_file_to_use = $thumbnails_found[$type]; }
|
if (isset($thumbnails_found[$type])) { $icon_file_to_use = $thumbnails_found[$type]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ function cpm_find_thumbnails($date_root) {
|
||||||
global $cpm_config;
|
global $cpm_config;
|
||||||
|
|
||||||
$thumbnails_found = array();
|
$thumbnails_found = array();
|
||||||
foreach (array('rss', 'archive') as $type) {
|
foreach (array('rss', 'archive', 'mini') as $type) {
|
||||||
if ($cpm_config->separate_thumbs_folder_defined[$type]) {
|
if ($cpm_config->separate_thumbs_folder_defined[$type]) {
|
||||||
$path = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
$path = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
||||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||||
|
@ -828,7 +828,7 @@ function cpm_find_thumbnails_by_filename($filename) {
|
||||||
global $cpm_config;
|
global $cpm_config;
|
||||||
|
|
||||||
$thumbnails_found = array();
|
$thumbnails_found = array();
|
||||||
foreach (array('rss', 'archive') as $type) {
|
foreach (array('rss', 'archive', 'mini') as $type) {
|
||||||
if ($cpm_config->separate_thumbs_folder_defined[$type]) {
|
if ($cpm_config->separate_thumbs_folder_defined[$type]) {
|
||||||
$thumb_filename = str_replace('/' . $cpm_config->properties["comic_folder"] . '/', '/' . $cpm_config->properties[$type . "_comic_folder"] . '/', $filename);
|
$thumb_filename = str_replace('/' . $cpm_config->properties["comic_folder"] . '/', '/' . $cpm_config->properties[$type . "_comic_folder"] . '/', $filename);
|
||||||
|
|
||||||
|
@ -1049,17 +1049,18 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||||
foreach ($cpm_config->separate_thumbs_folder_defined as $type => $value) {
|
foreach ($cpm_config->separate_thumbs_folder_defined as $type => $value) {
|
||||||
if ($value) {
|
if ($value) {
|
||||||
if ($cpm_config->thumbs_folder_writable[$type]) {
|
if ($cpm_config->thumbs_folder_writable[$type]) {
|
||||||
|
if (cpm_option("cpm-${type}-generate-thumbnails") == 1) {
|
||||||
|
$converted_target_filename = preg_replace('#\.[^\.]+$#', '', $target_filename) . '.' . $target_format;
|
||||||
|
|
||||||
$converted_target_filename = preg_replace('#\.[^\.]+$#', '', $target_filename) . '.' . $target_format;
|
$target = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
||||||
|
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||||
|
$target .= '/' . $subdir;
|
||||||
|
}
|
||||||
|
$target .= '/' . $converted_target_filename;
|
||||||
|
|
||||||
$target = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
if (!in_array($target, $write_targets)) {
|
||||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
$write_targets[$type] = $target;
|
||||||
$target .= '/' . $subdir;
|
}
|
||||||
}
|
|
||||||
$target .= '/' . $converted_target_filename;
|
|
||||||
|
|
||||||
if (!in_array($target, $write_targets)) {
|
|
||||||
$write_targets[$type] = $target;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2091,7 +2092,8 @@ function cpm_show_comicpress_details() {
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php foreach (array('archive' => __('Archive folder:', 'comicpress-manager'),
|
<?php foreach (array('archive' => __('Archive folder:', 'comicpress-manager'),
|
||||||
'rss' => __('RSS feed folder:', 'comicpress-manager'))
|
'rss' => __('RSS feed folder:', 'comicpress-manager'),
|
||||||
|
'mini' => __('Minithumb folder:', 'comicpress-manager'))
|
||||||
as $type => $title) {
|
as $type => $title) {
|
||||||
$realpath = realpath(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${type}_comic_folder"] . $subdir_path);
|
$realpath = realpath(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${type}_comic_folder"] . $subdir_path);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -14,8 +14,10 @@ class ComicPressConfig {
|
||||||
'blogcat' => '2',
|
'blogcat' => '2',
|
||||||
'rss_comic_folder' => 'comics',
|
'rss_comic_folder' => 'comics',
|
||||||
'archive_comic_folder' => 'comics',
|
'archive_comic_folder' => 'comics',
|
||||||
|
'mini_comic_folder' => 'comics',
|
||||||
'archive_comic_width' => '380',
|
'archive_comic_width' => '380',
|
||||||
'rss_comic_width' => '380',
|
'rss_comic_width' => '380',
|
||||||
|
'mini_comic_width' => '100',
|
||||||
'blog_postcount' => '10'
|
'blog_postcount' => '10'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -32,8 +34,8 @@ class ComicPressConfig {
|
||||||
var $is_cpm_managing_posts, $is_cpm_modifying_categories;
|
var $is_cpm_managing_posts, $is_cpm_modifying_categories;
|
||||||
var $wpmu_disk_space_message;
|
var $wpmu_disk_space_message;
|
||||||
|
|
||||||
var $separate_thumbs_folder_defined = array('rss' => null, 'archive' => null);
|
var $separate_thumbs_folder_defined = array('rss' => null, 'archive' => null, 'mini' => null);
|
||||||
var $thumbs_folder_writable = array('rss' => null, 'archive' => null);
|
var $thumbs_folder_writable = array('rss' => null, 'archive' => null, 'mini' => null);
|
||||||
var $allowed_extensions = array("gif", "jpg", "jpeg", "png");
|
var $allowed_extensions = array("gif", "jpg", "jpeg", "png");
|
||||||
|
|
||||||
function get_scale_method() {
|
function get_scale_method() {
|
||||||
|
@ -79,7 +81,8 @@ function cpm_calculate_document_root() {
|
||||||
// Strip the wp-admin part and just get to the root.
|
// Strip the wp-admin part and just get to the root.
|
||||||
$document_root = str_replace('\wp-admin','',getcwd());
|
$document_root = str_replace('\wp-admin','',getcwd());
|
||||||
$document_root = str_replace('/wp-admin','',$document_root); // For IIS
|
$document_root = str_replace('/wp-admin','',$document_root); // For IIS
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($wpmu_version)) {
|
if (isset($wpmu_version)) {
|
||||||
$document_root = cpm_wpmu_modify_path($document_root);
|
$document_root = cpm_wpmu_modify_path($document_root);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +356,9 @@ function cpm_read_information_and_check_config() {
|
||||||
$folders = array(
|
$folders = array(
|
||||||
array('comic folder', 'comic_folder', true, ""),
|
array('comic folder', 'comic_folder', true, ""),
|
||||||
array('RSS feed folder', 'rss_comic_folder', false, 'rss'),
|
array('RSS feed folder', 'rss_comic_folder', false, 'rss'),
|
||||||
array('archive folder', 'archive_comic_folder', false, 'archive'));
|
array('archive folder', 'archive_comic_folder', false, 'archive'),
|
||||||
|
array('mini thumb folder', 'mini_comic_folder', false, 'mini'),
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($folders as $folder_info) {
|
foreach ($folders as $folder_info) {
|
||||||
list ($name, $property, $is_fatal, $thumb_type) = $folder_info;
|
list ($name, $property, $is_fatal, $thumb_type) = $folder_info;
|
||||||
|
@ -765,4 +770,4 @@ function cpm_short_size_string_to_bytes($string) {
|
||||||
return $max_bytes;
|
return $max_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -56,6 +56,13 @@ $comicpress_configuration_options = array(
|
||||||
'description' => 'The width your comics will appear in the RSS feed',
|
'description' => 'The width your comics will appear in the RSS feed',
|
||||||
'default' => "380"
|
'default' => "380"
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'mini_comic_width',
|
||||||
|
'name' => 'Mini Comic Width',
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => 'The width your comics will appear in minithumbs',
|
||||||
|
'default' => "100"
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'blog_postcount',
|
'id' => 'blog_postcount',
|
||||||
'name' => 'Blog Post Count',
|
'name' => 'Blog Post Count',
|
||||||
|
|
|
@ -60,6 +60,13 @@
|
||||||
'default' => "1",
|
'default' => "1",
|
||||||
'message' => "If checked and server is configured correctly, generate RSS thumbnails"
|
'message' => "If checked and server is configured correctly, generate RSS thumbnails"
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'cpm-mini-generate-thumbnails',
|
||||||
|
'name' => "Generate Mini Thumbnails?",
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'default' => "1",
|
||||||
|
'message' => "If checked and server is configured correctly, generate mini thumbnails"
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'cpm-thumbnail-quality',
|
'id' => 'cpm-thumbnail-quality',
|
||||||
'name' => "Thumbnail Quality",
|
'name' => "Thumbnail Quality",
|
||||||
|
|
Loading…
Reference in New Issue