With CSS is possible:
CSS:
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Exemplo pt.stackoverflow - Pergunta 10483</title>
<style>
.quadroImagem {
display:inline-block;
margin: 0;
padding: 0;
width: 200px;
height: 200px;
text-align: center;
background-color: #FFF;
border: 1px solid #999;
line-height: 196px;
}
.quadroImagem img {
max-height: 200px;
max-width: 200px;
vertical-align:middle;
}
</style>
</head>
<body>
<div class="quadroImagem">
<img src="minha_imagem.jpg" />
</div>
</body>
</html>
Remembering that when changing the default size (in the example, 200px) the value of line-height should always be 4px smaller, i.e.:
To 400x400, line-height: 396px;
To 100x100, line-height: 96px;
The line-height is used to allow vertical centering indicated in the image itself with vertical-align: Middle;
Test and see. Use rectangular square images (with height greater than width and vice versa).
I don’t know the answer, but I’d start my research around here and around here
– brasofilo
I just found out that from WP 3.9 onwards we will be able to mark the position of Crop in
add_image_size
.– brasofilo