A
A
Almik Oh! Give me a guitar2015-07-30 12:56:18
PHP
Almik Oh! Give me a guitar, 2015-07-30 12:56:18

Wordpress how to check thumbnail image size when creating a post?

Hello, friends!
Again I turn to you with a question. To begin with, I would like to give an explanation because of what such a need arose.
In general, the site was created on Wordpress. To be honest, I didn't know what Wordpress was before. It had to be done.
There on the site there are regular posts that are a picture + text. The problem is that the User usually does not bother about the size and proportion of the picture : he (she) does not see the difference between a 10MB picture with a 4:7 aspect ratio and a 300 Kb 3:4 picture. As a result, you yourself understand that some pictures are stretched and others are compressed too much .
On the Internet I found a couple of functions limiting the size of the image which should be included in funtions.php , but it seems to me that there should be other solutions in the form of a plugin.
Question: what would you advise?
Sincerely ,
Almik

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Makarov, 2015-07-30
@facepook

I am using this code:

add_theme_support('post-thumbnails'); // Включаем поддержку миниатюр
set_post_thumbnail_size(80, 80); // Задаем размеры миниатюре

I
Igor Vorotnev, 2015-08-01
@HeadOnFire

Use the Imsanity plugin - it will save you from problems with huge images and save a lot of space on the site. As for small images, the first thing that comes to mind is to add a 3rd argument (true) to set_post_thumbnail_size( X, Y, true ), this will force WordPress to do the right crop. And then using CSS make the image rubbery, drag it to 100%. This will always fill the right space, although the quality of pictures that are too small, of course, will not be so hot.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question