Autogenerated Thumbnail compression depending on size

i’m looking for a more discrete and automatic approach. And that is altering the wp_create_thumbnail i think. And that is where you’d be wrong. Here is the entire code for wp_create_thumbnail() from core: function wp_create_thumbnail( $file, $max_side, $deprecated = ” ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, ‘1.2’ ); $thumbpath = image_resize( … Read more

WordPress 3.5 – Add custom image size

You can pest following code in function.php. add_theme_support(‘post-thumbnails’); add_image_size( $name, $width, $height, $crop); add_image_size(‘Home Top’, 120, 120, true); add_image_size(‘Home bottom’, 270, 90, false); add_image_size(‘Archive thumb’, 150, 75, true); add_image_size(‘Special’, 397, 224, true); add_image_size( ‘Test cropped’, 500, 500, true ); function sgr_display_image_size_names_muploader( $sizes ) { $new_sizes = array(); $added_sizes = get_intermediate_image_sizes(); foreach( $added_sizes as $key => … Read more

Getting specific image thumbnail urls of attached images

Have a look at wp_get_attachment_image_src <?php $attachment_id = 8; // attachment ID $image_attributes = wp_get_attachment_image_src( $attachment_id, ‘medium’ ); // returns an array if( $image_attributes ) { ?> <img src=”https://wordpress.stackexchange.com/questions/169475/<?php echo $image_attributes[0]; ?>” width=”<?php echo $image_attributes[1]; ?>” height=”<?php echo $image_attributes[2]; ?>”> <?php } ?> Source: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src#Default_Usage

No srcset for hard-cropped thumbnails

To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won’t be a srcset. You might find my answer here helpful. Briefly, in your case, adding this line: add_image_size ( ‘double-size’, … Read more

Store thumbnails and uploads in different directories?

It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea. There are hacks to filter the output for functions such as the_post_thumbnail_url(), but considering side issues such as the thumbnails not being able to be … Read more

Adding a photo to each WP user

I use a plugin called Avatar Manager for that function. The author has also done a tutorial on how to write your own avatar manager plugin, but unfortunately it is also a bit outdated and doesn’t work anymore. Although the plugin states it is compatible up to 3.6.1, it is still working in 3.8.1. I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)