wp_handle_upload Image sizes

I hope I understood your question correctly. Image size are automatically generated according to thumbnail sizes set. For this to work correctly, you first need to add support for thumbnails, and then add any image size that you need inside your theme. It is also important to know that you first add theme support and … Read more

Featured Image not displaying [closed]

See my answer here: https://stackoverflow.com/questions/26454205/how-can-i-add-thumbnail-to-recent-post-wordpress/26467188#26467188 In addition to the <?php the_post_thumbnail(); ?> (where you include this is where the image will appear), you have to make sure your theme has post thumbnails support. This needs to be in your theme function file: add_theme_support( ‘post-thumbnails’ );.

Media upload error

I found the solution. Rename your function.php file. Now it works fine for other themes. In my theme exactly the problem lies between the style tag. remove style tags and then check your admin panel. Thanks.

How to get attached image alt text in media.php?

In the answers to this forum post is mentioned that $alt = get_post_meta($attachment_id, ‘_wp_attachment_image_alt’, true); will get the job done for you. Maybe you should give that a try and look at the further information there.

If image width bigger than height [duplicate]

Use wp_get_attachment_metadata(). Using your example: $img_data = wp_get_attachment_metadata( $attachment_id ); $w = $img_data[‘width’]; $h = $img_data[‘height’]; if ($w > $h) { $class = “col-sm-12”; } else { $class = “col-sm-6”; } Though, to get the attachment ID, you’ll either have to put a filter that acts on every image or create a loop that uses … Read more

While doing a bulk upload the Media Images are showing blank?

Your $loopimage field in your spreadsheet only has the filename and not the file path, but wp_insert_attachment needs the full pathname in the 2nd argument. Additionally though, if you have uploaded all of these images using the Media Manager interface then they will already be stored as attachments. You’d be better off using the file … Read more