Tag Info

New answers tagged

0

hey dude is much easy i solve your problem open functions.php file and add this code for medium crop large crop. if(false === get_option("medium_crop")) { add_option("medium_crop", "1"); } else { update_option("medium_crop", "1"); } here is reference link ...


0

Look at this answer by Chip Bennet - Medium / Large images sizes aren't cropped by default ( and I also just verified on my install ). You can change the cropping of Thumbnails in Settings -> Media. It sounds like what you really need is just a new image size via add_image_size() which is also described in his answer. As far as removing unused images, ...


1

wp_get_attachment_image this function can help you. Using this function, your file should like below... entry-summary.php <?php the_title( '<h1 class="clear">', '</h1>' ); ?> <?php if ( has_post_thumbnail() ) { $attachment_id = get_post_thumbnail_id( get_the_ID() ); $default_attr = array( 'src' => $src, ...


1

I normally use something like: if ( current_theme_supports('post-thumbnails') && has_post_thumbnail() ) { $post_thumb_id = get_post_thumbnail_id($id); $image_data = wp_get_attachment_image_src($post_thumb_id, 'thumbnail'); $attr_title = esc_attr($title); $image = <<<HTML <div class="thumbnail"><img ...


0

EDIT: By default WordPress will crop thumbs to 150x150px when they are uploaded. When you uncheck the box in Settings>Media WordPress will not regenerate existing thumbnails, it will only generate proportional images when you upload new images. In short I believe your issue is not with the code you are using to display the thumbnail but the image itself. ...


1

You can collect image attributes using "wp_get_attachment_metadata", see below example as starting point function mytheme_post_thumbnail( $size = 'post-thumbnail', $attr = '', $post_id = null ) { if ( has_post_thumbnail( $post_id ) ) { $meta = wp_get_attachment_metadata( get_post_thumbnail_id( $post_id ) ); $args['width'] = ...


2

If you only want the size ( the width and the height ) of the image in the img tag like so <img src="source_of_your_image" width="500" height="250"/> Then use the following php code: $MySrc = "source_of_your_image"; $Myimg = "<img src='$MySrc' "; $TheImg = (array)getimagesize($MySrc); $Myimg .= $TheImg[3]."/>"; For more info on using ...


3

The defaults are Thumbnail 150x150, Medium 300x300, and Large 1024x1024. The fixed values can be changed in the admin dashboard under Settings > Media. You can also change them in your theme's functions.php: update_option( 'thumbnail_size_w', 160 ); // Set Thumbnail width - default 150 update_option( 'thumbnail_size_h', 160 ); // Set Thumbnail height - ...


4

The default post thumbnail/image sizes are set as follows thumb 150x150 medium 300x300 large 1024x1024 These defaults are set in wp-admin/includes/schema.php, currently in version 4.1 line 445 - 456 'thumbnail_size_w' => 150, 'thumbnail_size_h' => 150, 'thumbnail_crop' => 1, 'medium_size_w' => 300, 'medium_size_h' => 300, ..... ...



Top 50 recent answers are included