Every time you can upload image on Wp at its negative sizes. Its also automatically genrates 3 resized copies in the sandard sizes.
1 Thumbnail (150×150)
2 Medium (300×300)
3 Large (1024×1024)
This is a really powerful feature as it can be customized to make any image size. You just upload a single image, and WordPress creates the resized copies. This is done by modifying the functions.php file. To add new image sizes, you need to add calls to the add_image_size function. Here’s an example that adds four new image sizes:
1
2
3
4
|
add_image_size( 'sml_size', 300 );
add_image_size( 'mid_size', 600 );
add_image_size( 'lrg_size', 1200 );
add_image_size( 'sup_size', 2400 );
|
Each call to the function includes a name (so WordPress can identify the size) and a width. The new sizes will be 300, 600, 1200 & 2400 pixels wide. It is possible with the add_image_size function to have WordPress also set the height or crop the image, but the example above will keep the original image aspect ratio.
The example above only shows four new image sizes being added, but you may want to add more or less… this will be based on your theme design. Now any time an image is upload to WordPress, it will generate the new image sizes. The next step is to include them in the HTML.
Post a Comment