Auto-modifying original [full size] images

Yes, there is. Found here: http://www.wprecipes.com/how-to-automatically-use-resized-image-instead-of-originals It will replace the original picture with the large size, defined in Media Settings (/wp-admin/options-media.php). Here’s the code: add_filter(‘wp_generate_attachment_metadata’,’replace_uploaded_image’); function replace_uploaded_image($image_data) { // if there is no large image : return if ( !isset($image_data[‘sizes’][‘large’]) ) return $image_data; // paths to the uploaded image and the large image $upload_dir = … Read more

WP 3.5 and Galleries – how to count images?

This works: $images = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘numberposts’ => 999 )); if ( $images ) { $total_images = count( $images ); } The variable $total_images will hold the count of images in your gallery.

Uploading Images in the Link Manager

Well, started as a curiosity, ended up doing a plugin… : After finishing, I went to look in WordPress repository and…yes, there’s already one that does it: Easy Blogroll Image : At least, I took a different approach and did something different. Featured Link Image – [edit: released in the WordPress repository, link updated]

Change WordPress image URLs via filter

You will most likely want to use filters. The main issue is that developers will need to make sure to use the correct functions like “the_post_thumbnail()” etc. You can use wp_get_attachment_url https://codex.wordpress.org/Function_Reference/wp_get_attachment_url I use this when doing local development, but want all my local images to load from the Production server as I don’t have … Read more

Displaying images from external RSS feeds?

SimplePie, which ships with WordPress, does support images in feeds. Please see the SimplePie Reference if you need to look for specific functions regarding images. If you want to display images from feeds on your own site, you could for example create a plugin containing a custom widget that reads a feed for images. For … Read more

Delete the original big size image after upload and leave only 3 images crunched by media gallery

How about this: add_filter( ‘wp_generate_attachment_metadata’, ‘delete_fullsize_image’ ); function delete_fullsize_image( $metadata ) { $upload_dir = wp_upload_dir(); $full_image_path = trailingslashit( $upload_dir[‘basedir’] ) . $metadata[‘file’]; $deleted = unlink( $full_image_path ); return $metadata; } Not 100% sure everything will work ok without the main image, but it does the trick. You wont be able to regenerate the thumbnails / … Read more