Articles of add image size

Specific image size is being generated without being registered

I am looking at uploads folder and I see that 768×510 images are being generated. I am using my own theme and I don’t have that size registered, there isnt anything registered in media options in dashboard beside thumbnail (200×200) and it seems like it isnt registered in plugins either (I have used advanced search […]

add_image_size not working with the_post_thumbnail

Code in my funcitons.php function custom_thumbs() { add_image_size( ‘cover-size’, 1600, 450, true ); } add_action( ‘after_setup_theme’, ‘custom_thumbs’ ); Usage: echo the_post_thumbnail($post->ID,’cover-size’); but this is the result: <img width=”3648″ height=”2736″ src=”http://localhost/sonru/wp-content/uploads/2015/12/DSC04656.jpg” class=”attachment-9 size-9 wp-post-image” alt=”DSC04656″ cover-size=”” srcset=”http://localhost/sonru/wp-content/uploads/2015/12/DSC04656-300×225.jpg 300w, http://localhost/sonru/wp-content/uploads/2015/12/DSC04656-600×450.jpg 600w” sizes=”(max-width: 3648px) 100vw, 3648px”> What Am I missing here? -Edit- I’m already regenerating thumbnails using the […]

Process uploads with phpThumb before generating thumbnails

I was wondering if anyone knew a way (via function, plugin, or another method) of using phpThumb to process an image on upload, and then for WordPress to generate it’s usual image sizes from both the original and the processed image? Basically I’m using phpThumb to generate an alpha channeled version of the image, to […]

WordPress returns old thumbnail size after changing media settings

I have had a requirement to update a WP build so that the thumbnail size changes from (the default) 150×150 to 500×500. I’ve amended the size within the Settings > Media and utilised the awesome “Regenerate Thumbnails” plug-in to create the image files at the new sizes. So everything should be cool… alas not! When […]

add_image_size wont work after get_intermediate_image_sizes

I am using the function get_intermediate_image_sizes() to check if an image size already exists, and if not create it. However when I use add_image_size( ‘test3’, 150, 150, true ); after the call to get_intermediate_image_sizes() the image size is not created. The image size is created if I call add_image_size() before get_intermediate_image_sizes() Full code http://pastebin.com/NMYHvzLn Any […]

Is it a good practice to change media settings on theme activation?

I want to change default image sizes when user activates my theme so that the default medium image width is exactly the width of page content (for pages with sidebar) and the large image size fits nicely on full-width templates. Is it considered a bad practice?

add_image_size adds size, but doesn't upload if source resolution is same as resize resolution

I’m trying to add a new image size of 300×300.. This works, but if the uploaded file is for example 300×300, it doesn’t upload the resized image.. You’d say that isn’t a problem because the original is the resolution I need, but I get the image later on with: wp_get_attachment_image_src( $meta[‘background’][0], array(300,300) ); And if […]

WordPress Media Library showing wrong preview size?

When uploading new (or existing) images to the media library in WordPress 3.6.1 the preview generated on the admin page/edit media page (eg. wp-admin/post.php?post=8736&action=edit ) is showing one of my custom image sizes defined from my functions file, rather than the default size. I am using: add_image_size( ‘narrow’, 205, 450, true ); In functions.php with […]

Conditional Image Sizes for Use via Theme Customizer Upload Only

I’m looking for a way to add image sizes that are only generated by uploads happening in the Theme Customizer, any suggestions or direction on how this could be done? I’ve already worked with the intermediate_image_sizes_advanced filter, which gives me the images I want, the problem is that they don’t appear in the media library […]

Crop image to horizontal or vertical by code based on image size

my client asked me to create gallery(WP gallery) based on this site. the problem here is that i need to crop images based on image size before inserting the image in the Media library. now i using this code to check the image width and height: add_filter(‘wp_handle_upload_prefilter’,’validate_image_size’); function validate_image_size( $file ) { $image = getimagesize($file[‘tmp_name’]); […]