Answer the question
In order to leave comments, you need to log in
Why does this happen with pictures?
Hello everyone,
I noticed something incomprehensible to me and I can’t understand where my legs grow from ...
Situation:
If we display a picture for recording through:
the_post_thumbnail(array(200,100))
Then the code for some reason is like this:
<img width="178" height="100" src="http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17.jpg" class="attachment-200x100 size-200x100 wp-post-image" alt="робот" srcset="http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17.jpg 1920w, http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-300x169.jpg 300w, http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-1024x576.jpg 1024w, http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-768x432.jpg 768w, http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-1536x864.jpg 1536w, http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-1200x675.jpg 1200w" sizes="(max-width: 178px) 85vw, 178px">
the_post_thumbnail(array(100,100))
<img width="100" height="100" src="http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-150x150.jpg" class="attachment-100x100 size-100x100 wp-post-image" alt="робот">
Answer the question
In order to leave comments, you need to log in
I can assume the following ...
the_post_thumbnail(array(100,100))
such a proportion of the picture (1: 1) is available. Thumbnail - thumbnail size 150x150.
src="http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17-150x150.jpg"
the_post_thumbnail(array(200,100))
width="178" height="100" src="http://localhost:8089/wp-content/uploads/2020/02/robot-wallpaper-17.jpg"
add_image_size( 'customThumbnail', 200, 100, true );
in functions.php the_post_thumbnail('customThumbnail')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question