Gallery post images on homepage?

You could use this loop for fetching the images from current post. <?php $images = get_posts(array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘posts_per_page’ => 5, ‘post_mime_type’ => ‘image’ )); if( $image ) { foreach($images as $image) : echo wp_get_attachment_link( $image->ID, ‘thumbnail-size’, true ); endforeach; } ?> reference: wp_get_attachment_link wp_get_attachment_image

Resizing Images for a Gallery-Plugin?

Its best practice to always use internal WordPress API functions that already exist in place of external scripts. You would need to regenerate the thumbnails yourself, which is not overly difficult, if for instance you give yourself a head start and study the source code of existing and similar solutions; Regenerate Thumbnails Plugin http://wordpress.org/extend/plugins/regenerate-thumbnails/ browse … Read more

Is there a way to delete images from WordPress media library programmatically?

This can be achieved with wp_delete_attachment( $attachment->ID ); Here’s an example to delete all attachments related to a post: // Delete Attachments from Post ID 25 $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ => 25, ) ); foreach ( $attachments as $attachment ) { wp_delete_attachment( $attachment->ID ); }

Remove image classes from post thumbnail output

You might try something like this in your functions.php: //remove class from the_post_thumbnail function the_post_thumbnail_remove_class($output) { $output = preg_replace(‘/class=”.*?”https://wordpress.stackexchange.com/”, ”, $output); return $output; } add_filter(‘post_thumbnail_html’, ‘the_post_thumbnail_remove_class’);

add_image_size() to crop images into squares?

If you pass true for the last $crop argument then so called “hard” crop mode is used. This will make WP produce results at exact size specified, except few edge cases (if image uploaded is smaller than specified size for example). Note that original image is still retained as is. If you need to actually … Read more

Is it possible to pull and display a single landscape oriented image

Function to retrieve “landscape” oriented image function wpse_96012_landscape_image() { /* global post object holding info about the current post */ global $post; /* grab all images attached to the current post */ $attached_images = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’ ) ); /* set minimum ratio between width / height, … Read more

File format of post image attachment

$post_thumbnail_id = get_post_thumbnail_id(); $thumb = get_post($post_thumbnail_id); var_dump($thumb); Look at the post_mime_type in the $thumb object. Reference http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail http://codex.wordpress.org/Function_Reference/get_post

Get uploaded image path in wordpress by filename

I am not 100% sure I understand what you want but… WordPress treats attached media like a custom post type. The file name, minus the extension, is stored as the post_title in the $wpdb->posts table. So, to get the path just search for the file name minus the extension. $q = new WP_Query( array( ‘fields’ … Read more