How to get default image sizes attribute

If you want to get those set in the admin panel, use the function get_option. The keys are get_option(‘thumbnail_size_w’); get_option(‘thumbnail_size_h’); get_option(‘medium_size_w’); get_option(‘medium_size_h’); get_option(‘large_size_w’); get_option(‘large_size_h’); If you want them for some specific attachment, use wp_get_attachment_image_src

Why no images on a fresh WordPress installation?

I’ve figured it out. I had enabled hotlink protection. I installed the new blog in a new subdomain which was not added to the hotlink protection. So, it prevented the image requests. Now I added to the list and everything’s fine. Silly me. 🙁

Domain Change with New Image Sizes

Use plugin Regenerate Thumbnails to resize thumbnails. Edit: Try use filter “the_content” to convert in post content. <?php function foo ( $content ) { return preg_replace (‘/540×287/’, ‘525×279’, $content); } add_filter( ‘the_content’, ‘foo’ ) Filter “the_excerpt” if need convert excerpt too.

Pull images from the gallery

Use get_children() (Codex ref): $images = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ) ); The first image will be $images[0]. EDIT: And by “first image”, I mean, the $ID of the first image, which you can use with any of the myriad image- and … Read more

can you call the alt tag for an image dynamically?

I believe the alt attribute of the image is stored in post_content, isn’t it? To get the alt tag for an image with attachment ID $attachment_ID, you would just call: $alt_text = get_post( $attachment_ID )->post_content; To actually display the alt text dynamically on images that are already embedded in posts, you would have to do … Read more