Last active
January 4, 2016 22:36
-
-
Save RenzoTejada/4aab36c407a85a91ad23 to your computer and use it in GitHub Desktop.
Bloque de imágenes menores a determinadas medidas - función para wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bloqueo_images_pequenas($file) { | |
$type = explode('/', $file['type']); | |
if ($type[0] == 'image') { | |
list( $width, $height, $imagetype, $hwstring, $mime, $rgb_r_cmyk, $bit ) = getimagesize($file['tmp_name']); | |
if ($width < 600 && $height < 400) { | |
$file['error'] = __('ERROR: La imagen no cumple con las dimensiones minimas de 600x400- ancho act:' . $width . ' alto act:' . $height, 'textdomain'); | |
} | |
} | |
return $file; | |
} | |
add_filter('wp_handle_upload_prefilter', 'bloqueo_images_pequenas', 10, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment