hide/protect original full-size images

I was looking for a way to do this and found this page… then I thought of putting this in a .htaccess file in the WordPress uploads folder and it works for me so far… any good? <FilesMatch “\.jpg$”> order allow,deny deny from all </FilesMatch> <FilesMatch “-[0-9]+x[0-9]+\.jpg$”> order allow,deny allow from all </FilesMatch> The first … Read more

Need help building a filter to edit the output of “image_send_to_editor”

Your best bet here would be to use jQuery to grab any link that links to an image and tell it to use fanceybox. jQuery(document).ready(function($){ $(‘a[href$=”jpg”], a[href$=”png”], a[href$=”jpeg”]’).fancybox(); }); If you want this to work just for your post content areas use this: $(‘.post-content a[href$=”jpg”], .post-content a[href$=”png”], .post-content a[href$=”jpeg”]’).fancybox(); You will need to replace .post-content … Read more

Associate an existing image with a post

You can modify an existing media library image using wp_insert_attachment by setting the ID key in the parameter array. $attachment = array( ‘ID’ => $existing_library_attachment_id, ‘post_parent’ => $custom_post_id ); wp_insert_attachment( $attachment ); This will update the attachment post with ID $existing_library_attachment_id to have a post_parent value of $custom_post_id. However, the only thing this will affect … Read more

Add aditional class to get_avatar when showing image

I had this problem, too. Here’s the solution for version 4.7.3 if anyone comes across this. get_avatar( $id_or_email = get_the_author_meta( ‘user_email’ ), $size=”60″, $default, $alt, $args = array( ‘class’ => array( ‘d-block’, ‘mx-auto’ ) ) ); or shorter version get_avatar( get_the_author_meta( ‘user_email’ ), ’60’, $default, $alt, array( ‘class’ => array( ‘d-block’, ‘mx-auto’ ) ) ); … Read more

Fixing external image urls

Since the request is sending to the blogspot server, no .htaccess wont wont. You could filter your post content output: add_filter(‘the_content’, function($the_content) { return str_replace(‘/s400′,’/s1600′,$the_content); }); Or you could edit modify the database global $wpdb; $wpdb->query(“UPDATE $wpdb->posts SET `post_content` = REPLACE(`post_content`,’/s400′,’/s1600′);”); Or do it in mysql UPDATE wp_posts SET `post_content` = REPLACE(`post_content`,’/s400′,’/s1600’; assuming wp_posts is … Read more

Can WordPress resize BMP files?

No, wordpress can not resize BMP files. Beware that it does not make sense to use BMP files in a website because a broad number of webbrowsers is not able to display them. Filetypes that are supported by WordPress and which are widely supported by internet browsers are: GIF, JPG and PNG. Those formats are … Read more

Black and White thumbnails

You can use the php GD library which you most likely already have on your server since wordpresses uses it. You can filter the image using imagefilter specifically IMG_FILTER_GRAYSCALE and/or IMG_FILTER_CONTRAST. For example imagefilter($im, IMG_FILTER_GRAYSCALE); imagefilter($im, IMG_FILTER_CONTRAST, -100); The hover would have to been done in javascript. A much simpler solution would be to use … Read more