una tamaño redimensionar para miniaturas imagenes imagen destacada como cambiar php wordpress woocommerce crop image-size

php - redimensionar - tamaño de imagenes para woocommerce



Cómo cambiar la posición de recorte de miniaturas de WooCommerce? (1)

Para cambiar los tamaños de las imágenes existentes (opción de recorte) dentro de su tema o tema secundario activo, debe usar ''after_switch_theme'' gancho de WordPress ''after_switch_theme'' .

Desde WordPress 3.9+, una nueva característica impresionante entre muchas, es la capacidad añadida de controlar ahora la posición de recorte de las imágenes cargadas en WordPress.
No sé si la opción avanzada de poción de cultivo está disponible para tamaños de imágenes woocommerce, tendrá que probarla.

Las opciones disponibles para la posición de cultivo son:

left top left center left bottom right top right center right bottom center top center center center bottom

Por lo tanto, basándonos en este fragmento de wooThemes y (y esta nueva) opciones de recorte de WordPress, puedes probar esto:

function yourtheme_woocommerce_image_dimensions() { global $pagenow; if ( ! isset( $_GET[''activated''] ) || $pagenow != ''themes.php'' ) { return; } $catalog = array( ''width'' => ''300'', // px ''height'' => ''400'', // px ''crop'' => array( ''center'', ''bottom'' ) // New crop options to try. ); /* $single = array( ''width'' => ''600'', // px ''height'' => ''600'', // px ''crop'' => 1 // true ); $thumbnail = array( ''width'' => ''120'', // px ''height'' => ''120'', // px ''crop'' => 0 // false ); */ // Image sizes update_option( ''shop_catalog_image_size'', $catalog ); // Product category thumbs /* update_option( ''shop_single_image_size'', $single ); // Single product image update_option( ''shop_thumbnail_image_size'', $thumbnail ); // Image gallery thumbs */ } add_action( ''after_switch_theme'', ''yourtheme_woocommerce_image_dimensions'', 1 );

Deberá pegar este fragmento de código en el archivo function.php de su tema o tema secundario activo ...

Puede comentar / descomentar el código (o eliminar algunas partes) según sus necesidades. Este código sobrescribirá las opciones de definición en la configuración de WooCommerce> Productos> Pantalla (Imágenes de producto).

ACTIVACIÓN:
Tendrá que cambiar su tema activo a otro y luego volver a activarlo.

Referencias

Estoy intentando cambiar la posición de recorte de miniaturas de WooCommerce. Encontré este código que puede ayudar a cambiar el tamaño:

add_action( ''init'', ''yourtheme_woocommerce_image_dimensions'', 1 ); /** * Define image sizes */ function yourtheme_woocommerce_image_dimensions() { $catalog = array( ''width'' => ''100'', // px ''height'' => ''100'', // px ''crop'' => 0 ); // Image sizes update_option( ''shop_catalog_image_size'', $catalog ); // Product category thumbs }

Intenté como cambiar cultivo 0 a array("center", "bottom") pero no funciona:

function yourtheme_woocommerce_image_dimensions() { $catalog = array( ''width'' => ''300'', // px ''height'' => ''400'', // px ''crop'' => ''array("center", "bottom")'' ); // Image sizes update_option( ''shop_catalog_image_size'', $catalog ); // Product category thumbs }

Y también esto sin éxito:

if (function_exists( ''add_image_size'' )){ add_image_size( ''shop_catalog'', 300, 400, array( ''center'', ''bottom'' ) ); }

¿Hay alguna forma de que pueda cambiarlo?

Gracias.