0
votes

I have a problem. When I post a featured image in a post and I publish, the only thing that is seen is one color background. The funny thing is that only one picture works. I have 5 pictures. 1 of them is showing up. All have the same size, all are .jpg. I don't know what to do. Has anybody seen something like that? This is the functions.php

function fotosani_setup(){
add_theme_support('post-thumbnails');
add_image_size('small-thumbnail', true); /* width, height, softcrop*/
add_image_size('banner-image', true);

}

add_action('after_setup_theme','fotosani_setup');

CSS is just styling for the border.

single.php is calling in the same way as in index.php

                  <div class="post-image">
                        <?php the_post_thumbnail('banner-image'); ?>

                    <?php
                        echo the_content();
                        if(is_active_sidebar ('post1')) : ?>
                </div>
1
can you show us a URL? or some generate HTML/CSS that we can analyze? - hanshenrik
I updated the question. - Sani
you'll have to provide more info: is this on a single post page? A page of posts? What is does the php look like that is used to display the image? - alexwc_
It is on a single post page and on page of posts (home blog). The php I'll provide up in the question in a second. - Sani
I don't know why one picture works. If you go on www.fotosani.eu you can see one post. That is the picture that works. If i use other images they don't work, they display just a s a one color background. - Sani

1 Answers

1
votes

Your function calls to add_image_support() are not correct.

add_image_size('small-thumbnail', true); /* width, height, softcrop*/
add_image_size('banner-image', true);

is equivalent to:

add_image_size('small-thumbnail', 1); /* width, height, softcrop*/
add_image_size('banner-image', 1);

In other words, you are creating images that are 1px wide.

You need to set the widths and heights to what you want, just like the comment says:

add_image_size('small-thumbnail', some width, some height, true/false);
add_image_size('banner-image', some width, some height, true/false);