25

When an image is uploaded in WordPress, it is saved in its original size, and also as some resized copies in different sizes. In this way it becomes easy to use different sizes, of the same image, for different purposes. By default, WordPress creates 3 copies in 3 different sizes: 'thumb' 'medium' 'large' The size in pixels for these 3 sizes can be set in ...


20

You can use the oEmbed functionality baked into WordPress. Typically any video host on this list will return a thumbnail to you using oembed. Here is a list of default providers that WordPress uses for auto embedding in the content area. I've included non-video sources as well for the convenience of others. http://www.youtube.com/oembed http://blip.tv/...


14

To built on Max Yudin's answer you should use the intermediate_image_sizes_advanced filter, and not image_size_names_choose. Add to functions.php function add_image_insert_override($sizes){ unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); return $sizes; } add_filter('intermediate_image_sizes_advanced', '...


14

Create image file in PNG Format having name screenshot.png and save it in themes root folder.The recommended image size is 880x660. Even recommended image size is 880x660 though it will only be shown as 387x290 but the double-sized image allows for high-resolution viewing on HiDPI displays. For more information see this page. If you don’t already have a ...


10

You need to define your arguments before you pass them to WP_Query, not after. Also, your meta_query should be an array of an array, not just an array This $query = new WP_Query($thumbs); $thumbs = array( 'meta_query' => array('key' => '_thumbnail_id') ); should look like this $thumbs = array( 'meta_query' => array( ...


9

You can also filter intermediate_image_sizes with an empty array. add_filter( 'intermediate_image_sizes', '__return_empty_array' );


8

You can turn your snippet into a function that returns the post thumbnail URL of a post: function wpse81577_get_small_thumb_url( $post_id ) { $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'small' ); return $thumbSmall['0']; } Usage, supplying the ID of a post: <?php echo wpse81577_get_small_thumb_url( 59 ); ?>


8

A quick and easy fix for this is to make use of a plugin called Force Regenerate Thumbnails (to which I don't have any affiliation to) Unlike a plugin like Regenerating Thumbnails, Force Regenerate Thumbnails creates all your new custom sizes and delete all redundant/orphaned sizes. Force Regenerate Thumbnails allows you to delete all old images size ...


7

I believe your issue is that the value set for the global $content_width variable (which is 640px in Boilerplate and 584px in Twenty Eleven) is less than the width you're specifying via Settings -> Media. WordPress is overriding your user setting with the Theme-specific value. This actually makes sense, since a Theme knows its maximum content width, and ...


7

This should get you started: Loop over all posts and build an array of linked image files Loop over all image attachments & cross check if any of them have been linked to Might need to batch it or boost the timeout & memory limit, depending on the server & number of posts you're working with. $posts = get_posts( array( '...


7

That's easy! If you have SSH access, log in and do the following for each size. I am just showing 150x150 size only. Go to the desired uploads folder via command line. cd /your-site.com/wp-content/uploads Let's find if that size is available. find ./uploads/* -iname '*-150x150.*' -ls If you see some images as the output then delete 'em with find ./...


7

Thumbnails in WordPress can be generated by using wp_generate_attachment_metadata(), this function fires a filter after generating all the thumbnails wp_generate_attachment_metadata and the filter provides $metadata and $attachment_id to the hooked functions. You can hook your custom function to this filter. $metadata : Attachment metadata. What you need ...


6

add_filter('intermediate_image_sizes_advanced', 'filter_image_sizes'); function filter_image_sizes( $sizes) { unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); return $sizes; }


6

Figured it out after a lot of trial and error and a lot of var_dumps. $image = wp_get_image_editor($file); if ( ! is_wp_error( $image ) ) { $image->resize( $width, $height, true ); $final_image = $image->save( $file ); } Then i can use the $final_image array to get what i need. It actually saved me a step from what i was doing and seems to ...


6

I have just achieved the effect by my own. I will post it here in case others find this thread: jQuery(document).on('click','.thumbnails .zoom', function(){ var photo_fullsize = jQuery(this).find('img').attr('src').replace('-100x132',''); jQuery('.woocommerce-main-image img').attr('src', photo_fullsize); return false; }); ....


6

You can do that because you can add all the attributes you need: the_post_thumbnail( 'large', array( 'title' => get_the_title() ) ); Please read on in the Function Reference of the_post_thumbnail.


6

Don't know why you want to do it when there're update_post_thumbnail_cache() in WordPress and set expire headers on server side. But you can try this in your functions.php: add_filter('wp_get_attachment_image_src', function($img, $id, $size, $icon) { $img[0] = $img[0] . '?v=20160505'; return $img; }, 10, 4);


5

The first argument that get_previous_post and get_next_post is $in_same_cat. WordPress is looking for post of the same type in the current posts category. If your custom post type doesn't support the category taxonomy, both functions are likely to return nothing for the previous and next post. Try calling both functions without arguments for your custom ...


5

Notes Solution for YouTube and Vimeo. Uses Featured Image or default thumbnail from video provider. If more than one oEmbed exists in the same page, using the Featured Image provoques duplicate "thumbs". Post has to be updated before changes are seen. To do: <iframe> and <img> sizes, other oEmbeds. Sources of Inspiration oEmbed oEmbed, ...


5

Demo Plugin - Fixed Size Here's one suggestion as a demo plugin (PHP 5.4+): <?php /* Plugin Name: Custom Playlist Thumb Size */ namespace WPSE238646\PlaylistThumbSize; add_shortcode( 'playlist', function( $atts = [], $content = '' ) { add_filter( 'wp_get_attachment_image_src', __NAMESPACE__ . '\\src' , 10, 3 ); $out = wp_playlist_shortcode( $...


5

To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won't be a srcset. You might find my answer here helpful. Briefly, in your case, adding this line: add_image_size ( 'double-size', 1270, 400, true ); ... will make a ...


4

Answers: Try this plugin which uses the ffmpeg library This video conversion plugin looks quite promising with wide range of format support Hope it helps. Thanks!


4

You can get the featured image src/source by using the following arguments on the core function (where $post, should be called with global $post in front): wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); How-to use it I wrote a free plugin available on GitHub, called "Dynamic Image Resize". You can download &...


4

Seems that the answer is no... I've followed the core functions and found a dead-end. And found this post ( How can I make add_image_size() crop from the top? ) where Rarst says: Intermediate image generation is extremely rigid. Image_resize() keeps it close to code and completely lacks hooks. But, following the lead of the other answer (from bradt) ...


4

Research The question Filter For Featured Image lead to this answer: How to hook update_post_meta and delete_post_meta?. Coupled with the a fine global variable ($_wp_additional_image_sizes) revealed here: How to get a list of all the possible thumbnail sizes set within a theme, bring us to the code that catches the "Use as featured image" action click. ...


4

There's a lot going on here. First off, you should store the repeater field image as an ID (that probably requires changing how the subfield's setting and possibly re-uploading some of your images) and then use all the WordPress Core API functions to handle it. (You'll probably cross paths with wp_get_attachment_image_src.) That gets rid of your regex-ing, ...


4

JavaScript solution As the original answer already work with string replace, but has to get altered for each and every use case, here's a solution using a fast Regex .test() wrapped up in a self invoking function that uses the default method to prevent events (like following links) from happening. This plugin will delete the first occurrence of any 2-4 ...


4

As per the Codex entry for the_post_thumbnail(), you can pass an attributes array as a parameter: <?php the_post_thumbnail( $size, $attr ); ?> So you would just need to define the array; here's the Codex example, modified to include the title attribute: $post_thumbnail_attr = array( 'src' => $src, 'class' => "attachment-$size", '...


4

I found the same issue here and the solution from there works. The solution is as simple as pasting this: $content_width = 2000;// Value higher than your new 'large' width in functions.php Explanation copied from there(user Chip Bennett): I believe your issue is that the value set for the global $content_width variable (which is 640px in Boilerplate ...


4

There's not enough info to be sure this answer is definitive but here's an attempt. Firstly make sure the image you are uploading is actually larger than the size you have defined. I see people upload images that are too small and then get this sort of result all the time. Secondly, WP will only make up a Srcset list of image sizes with the same aspect ...


Only top voted, non community-wiki answers of a minimum length are eligible