diff --git a/comicpress_manager_admin.php b/comicpress_manager_admin.php index 56b735e..652d1d9 100644 --- a/comicpress_manager_admin.php +++ b/comicpress_manager_admin.php @@ -425,7 +425,7 @@ function cpm_manage_posts_custom_column($column_name) { $thumbnails_found = cpm_find_thumbnails_by_filename($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]; } } @@ -803,7 +803,7 @@ function cpm_find_thumbnails($date_root) { global $cpm_config; $thumbnails_found = array(); - foreach (array('rss', 'archive') as $type) { + foreach (array('rss', 'archive', 'mini') as $type) { if ($cpm_config->separate_thumbs_folder_defined[$type]) { $path = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"]; if (($subdir = cpm_get_subcomic_directory()) !== false) { @@ -828,7 +828,7 @@ function cpm_find_thumbnails_by_filename($filename) { global $cpm_config; $thumbnails_found = array(); - foreach (array('rss', 'archive') as $type) { + foreach (array('rss', 'archive', 'mini') as $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); @@ -1049,17 +1049,18 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) { foreach ($cpm_config->separate_thumbs_folder_defined as $type => $value) { if ($value) { 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 (($subdir = cpm_get_subcomic_directory()) !== false) { - $target .= '/' . $subdir; - } - $target .= '/' . $converted_target_filename; - - if (!in_array($target, $write_targets)) { - $write_targets[$type] = $target; + if (!in_array($target, $write_targets)) { + $write_targets[$type] = $target; + } } } } @@ -2091,7 +2092,8 @@ function cpm_show_comicpress_details() { __('Archive folder:', 'comicpress-manager'), - 'rss' => __('RSS feed folder:', 'comicpress-manager')) + 'rss' => __('RSS feed folder:', 'comicpress-manager'), + 'mini' => __('Minithumb folder:', 'comicpress-manager')) as $type => $title) { $realpath = realpath(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${type}_comic_folder"] . $subdir_path); ?> diff --git a/comicpress_manager_library.php b/comicpress_manager_library.php index 2dc912d..528af94 100644 --- a/comicpress_manager_library.php +++ b/comicpress_manager_library.php @@ -14,8 +14,10 @@ class ComicPressConfig { 'blogcat' => '2', 'rss_comic_folder' => 'comics', 'archive_comic_folder' => 'comics', + 'mini_comic_folder' => 'comics', 'archive_comic_width' => '380', 'rss_comic_width' => '380', + 'mini_comic_width' => '100', 'blog_postcount' => '10' ); @@ -32,8 +34,8 @@ class ComicPressConfig { var $is_cpm_managing_posts, $is_cpm_modifying_categories; var $wpmu_disk_space_message; - var $separate_thumbs_folder_defined = array('rss' => null, 'archive' => null); - var $thumbs_folder_writable = 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, 'mini' => null); var $allowed_extensions = array("gif", "jpg", "jpeg", "png"); function get_scale_method() { @@ -79,7 +81,8 @@ function cpm_calculate_document_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','',$document_root); // For IIS - + } + if (isset($wpmu_version)) { $document_root = cpm_wpmu_modify_path($document_root); } @@ -353,7 +356,9 @@ function cpm_read_information_and_check_config() { $folders = array( array('comic folder', 'comic_folder', true, ""), 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) { list ($name, $property, $is_fatal, $thumb_type) = $folder_info; @@ -765,4 +770,4 @@ function cpm_short_size_string_to_bytes($string) { return $max_bytes; } -?> +?> \ No newline at end of file diff --git a/cp_configuration_options.php b/cp_configuration_options.php index b336859..21235f3 100644 --- a/cp_configuration_options.php +++ b/cp_configuration_options.php @@ -56,6 +56,13 @@ $comicpress_configuration_options = array( 'description' => 'The width your comics will appear in the RSS feed', '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( 'id' => 'blog_postcount', 'name' => 'Blog Post Count', diff --git a/cpm_configuration_options.php b/cpm_configuration_options.php index d36c199..ad96036 100644 --- a/cpm_configuration_options.php +++ b/cpm_configuration_options.php @@ -60,6 +60,13 @@ 'default' => "1", '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( 'id' => 'cpm-thumbnail-quality', 'name' => "Thumbnail Quality",