Community Forums › Forums › Archived Forums › Design Tips and Tricks › add_image_size not working
Tagged: custom image sizes, image, media
- This topic has 10 replies, 4 voices, and was last updated 9 years, 5 months ago by
MissKitty.
-
AuthorPosts
-
March 7, 2015 at 3:21 am #143558
trash
ParticipantHello,
I want to add new image sizes to my WP install. I have written the following line in my functions.php of my child theme://Add Image Size add_image_size( 'greyarticle-thumb', 214, 214, true );But when I upload a new image, WP creates the usual three versions of the image, without creating an image that is 214x214px.
Am I missing something? I also tried it this way, but even this does not work.
//Image settings add_action( 'after_setup_theme', 'custom_theme_setup' ); function custom_theme_setup() { add_image_size( 'greyarticle-thumb', 214, 214, true ); }Is there something missing on my server? How can I check this?
Thanks!
March 7, 2015 at 3:24 am #143559Brad Dalton
ParticipantShould work, for new images only. Here's the full docs http://codex.wordpress.org/Function_Reference/add_image_size
March 7, 2015 at 3:29 am #143561trash
ParticipantHey braddalton,
thanks - I looked in the Codex. I just found out, that on the FTP I have the image in size 214x214, but the Dropdown-List when I want to insert the Image in a Post is missing that size.How can that happen? Did I miss any setting which adds 214x214 to the dropdown menu?
March 7, 2015 at 4:06 am #143562Brad Dalton
ParticipantAre you using both code snippets in your functions file or just one?
It should work with one line like this:
add_image_size( 'slider', 1140, 445, TRUE );
Is there any server side caching?
March 7, 2015 at 4:47 am #143566trash
ParticipantI pasted both examples which I tried, but when checking of this works I am just using one code snippet at a time.
Isn't it strange, that the files get created, but the dropdown does not show the size at all....hm
March 7, 2015 at 5:56 am #143567Brad Dalton
ParticipantJune 10, 2016 at 1:15 pm #187339MissKitty
ParticipantHi guys - I'm having the same issue. I've added a custom size and regenerated thumbnails:
add_image_size( 'medium-small', 200, 200, TRUE );//custom jlr
and I can apply the custom size using the text editor, but the custom size doesn't show up in any drop-down (media or media gallery).Any update on this?
June 10, 2016 at 1:29 pm #187343Victor Font
ModeratorThere's one more step you have to take is you want the image to appear in the drop down: http://victorfont.com/add-custom-image-sizes-to-media-library/
function post_image_sizes($sizes){ $custom_sizes = array( 'greyarticle-thumb' => 'Grey Article' ); return array_merge( $sizes, $custom_sizes ); } add_filter('image_size_names_choose', 'post_image_sizes');
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?June 10, 2016 at 1:33 pm #187346MissKitty
ParticipantOh my word, you are a GENIUS, Victor 🙂
A million thank you's, that worked like a charmJune 10, 2016 at 2:05 pm #187360MissKitty
ParticipantOops one other question, how would I edit the extra code if I had more than one custom thumbnail size?
thanks in advance.June 10, 2016 at 2:18 pm #187361MissKitty
ParticipantMy apologies - I figured it out! 🙂
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.