Featured Image Size

For post thumbnails you can either crop and image to the thumbnail size or scale the image. To enable crop you can call the thumbnail 1 of 2 ways. Name a size in the functions.php file like so: <?php add_image_size( ‘my-post-thumbnail’, 494, 168, true ); ?> and then call it in the theme file <?php … Read more

Limit author image size

WordPress automatically resizes uploads into different formats based on the settings on the Settings » Media page: You can set up all of your different default sizes here. Though keep in mind that plug-ins and themes can define their own custom image sizes … so I can’t guarantee perfect operability in all cases.

How to get an image transferred via FTP or script to appear in Media Manager?

add this to your for each and $filename to each file, $wp_filetype = wp_check_filetype(basename($filename), null ); $attachment = array( ‘post_mime_type’ => $wp_filetype[‘type’], ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename($filename)), ‘post_content’ => ”, ‘post_status’ => ‘inherit’ ); $attach_id = wp_insert_attachment( $attachment, $filename, 0 ); // you must first include the image.php file // for the function wp_generate_attachment_metadata() to … Read more

How to add an image for unit testing?

I’d take a look at how WordPress has constructed their attachment tests. You’ll find that tests/phpunit/tests/post/attachments.php they use this method: function _make_attachment( $upload, $parent_post_id = 0 ) { $type=””; if ( !empty($upload[‘type’]) ) { $type = $upload[‘type’]; } else { $mime = wp_check_filetype( $upload[‘file’] ); if ($mime) $type = $mime[‘type’]; } $attachment = array( ‘post_title’ … Read more

Automatically Add Caption in image

You can add programmatically caption, alt, description every time you upload image at backend. https://brutalbusiness.com/automatically-set-the-wordpress-image-title-alt-text-other-meta/ I tried myself this and worked nice as your expectation. This is for all your future upload images. Try this and let me know. /* Automatically set the image Title, Alt-Text, Caption & Description upon upload ————————————————————————————–*/ add_action( ‘add_attachment’, ‘my_set_image_meta_upon_image_upload’ … Read more

Responsive background images added inline

If you use Adaptive Images plugin for WordPress, you would just make one inline css for all viewport widths using the biggest image and then it does all the work on the server. You do nothing to your markup but in the Adaptive Images plugin settings you enter your breakpoints, so it will serve small … Read more

How to link to the image editor’s Edit Image function?

You may add the following scripts: wp_enqueue_script( ‘wp-ajax-response’ ); wp_enqueue_script(‘image-edit’); wp_enqueue_style(‘imgareaselect’); Maybe this already helps? I think the html in the front-end should be similar to the html in /wp-admin/media.php?attachment_id=…&action=edit

Ability to edit image via WYSIWYG

You maybe smoking something, but it doesn’t change the fact that you are right 😉 WP image management, (or should I say TinyMCE image management) is really sub par. ImagePro might be a good solution for you. Not only does it help replacing images in editor but also resizes them and displays a server-generated resized … Read more