resize - How do I make add_image_size thumbnails percentages in php? -
in theme-functions.php file, have
add_image_size('ad-medium', $width = 250, $height = 250, true );
this determines size wordpress creates 'ad-medium' thumbnails. changes code determine shown on website instantly.
so if change 250 100, width reduced 100px. unfortunately, has 3 problems:
- this changes dimensions of future upload resizing ad-medium, that's out of question.
- the height ignored - can't warp - stays 1:1 aspect ratio no matter what.
- i can't write 100%. percentage sign not understood.
in context, code is:
<?php } // activate theme support items if (function_exists('add_theme_support')) { // added in 2.9 // theme uses post thumbnails add_theme_support('post-thumbnails', array('post', 'page')); set_post_thumbnail_size(100, 100); // normal post thumbnails // add default posts , comments rss feed links head add_theme_support( 'automatic-feed-links' ); } // setup different image sizes if ( function_exists( 'add_image_size' ) ) { add_image_size('blog-thumbnail', 150, 150); // blog post thumbnail size, box crop mode add_image_size('sidebar-thumbnail', 140, 140, true); // sidebar blog thumbnail size, box crop mode // create special sizes ads add_image_size('ad-thumb', 75, 75, true); add_image_size('ad-small', 100, 100, true); add_image_size('ad-medium', $width = 250, $height = 250, true ); //add_image_size('ad-large', 500, 500); } // set content width based on theme's design , stylesheet. // used set width of images , content. should equal width theme // designed for, via style.css stylesheet. if (!isset($content_width)) $content_width = 500; // theme supports native menu options, , uses wp_nav_menu() in 1 location top navigation. function appthemes_register_menus() { register_nav_menus(array( 'primary' => __( 'primary navigation', 'appthemes' ), 'secondary' => __( 'footer navigation', 'appthemes' ), 'theme_dashboard' => __( 'theme dashboard', 'appthemes' ) )); } add_action( 'init', 'appthemes_register_menus' ); //ajax header javascript builder child categories ajax dropdown builder function cp_ajax_addnew_js_header() { global $app_abbr; $parentposting = get_option($app_abbr.'_ad_parent_posting'); // define custom javascript function ?>
how can leave thumbnail resizing feature alone , add line of code resize 100% width 100% height? @ moment, whole page resizing except stubborn thumbnails.
please let me know do.
thanks.
see: http://codex.wordpress.org/post_thumbnails: post thumbnails given class "wp-post-image". class depending on size of thumbnail being displayed can style output these css selectors.
so can add theme css file:
#content img.ad-medium {height:100%; width:100%;}
Comments
Post a Comment