rescaling images for comic use via wp functions now working
This commit is contained in:
parent
1f230256fe
commit
89c1b216ee
@ -140,7 +140,7 @@ class ComicPressAddonCore extends ComicPressAddon {
|
|||||||
/**
|
/**
|
||||||
* Show an archive comic.
|
* Show an archive comic.
|
||||||
*/
|
*/
|
||||||
function show_archive($override_post = null, $format = "") {
|
function show_archive($override_post = null, $format = "%s<br />") {
|
||||||
$this->show_media($override_post, "display_archive", $format);
|
$this->show_media($override_post, "display_archive", $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,19 @@ class ComicPress {
|
|||||||
add_action('wp_footer', array(&$this, 'announce_activated_helpers'));
|
add_action('wp_footer', array(&$this, 'announce_activated_helpers'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_filter('intermediate_image_sizes', array(&$this, 'intermediate_image_sizes'));
|
||||||
|
|
||||||
|
foreach (array('comic', 'rss', 'archive', 'mini') as $size) {
|
||||||
|
list($w, $h) = explode("x", $this->comicpress_options["${size}_dimensions"]);
|
||||||
|
update_option("${size}_size_w", $w);
|
||||||
|
update_option("${size}_size_h", $h);
|
||||||
|
update_option("${size}_crop", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function intermediate_image_sizes($sizes) {
|
||||||
|
return array_merge($sizes, array('comic', 'rss', 'archive', 'mini'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function needs_storyline_nav() {
|
function needs_storyline_nav() {
|
||||||
|
@ -32,8 +32,15 @@ class ComicPressComicPost {
|
|||||||
if (get_post_meta($attachment_id, "comic_image_type", true) == $type) {
|
if (get_post_meta($attachment_id, "comic_image_type", true) == $type) {
|
||||||
$attachment = get_post($attachment_id);
|
$attachment = get_post($attachment_id);
|
||||||
$title = (!empty($attachment->post_excerpt) ? $attachment->post_excerpt : $attachment->post_title);
|
$title = (!empty($attachment->post_excerpt) ? $attachment->post_excerpt : $attachment->post_title);
|
||||||
|
|
||||||
|
$url = wp_get_attachment_url($attachment->ID, '');
|
||||||
|
$sizes = image_downsize($attachment->ID, $size_type);
|
||||||
|
if ($sizes) {
|
||||||
|
$url = $sizes[0];
|
||||||
|
}
|
||||||
|
|
||||||
$output[] = apply_filters('comicpress_attached_image',
|
$output[] = apply_filters('comicpress_attached_image',
|
||||||
sprintf($format, $this->get_comic_img_tag(wp_get_attachment_url($attachment->ID, ''), $size_type, array('title' => $title))),
|
sprintf($format, $this->get_comic_img_tag($url, $size_type, array('title' => $title))),
|
||||||
$attachment_id,
|
$attachment_id,
|
||||||
$i++);
|
$i++);
|
||||||
$found = true;
|
$found = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user