Skip to content

Instantly share code, notes, and snippets.

@RenzoTejada
Last active January 4, 2016 22:36
Show Gist options
  • Save RenzoTejada/4aab36c407a85a91ad23 to your computer and use it in GitHub Desktop.
Save RenzoTejada/4aab36c407a85a91ad23 to your computer and use it in GitHub Desktop.
Bloque de imágenes menores a determinadas medidas - función para wordpress
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