Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/10/2016, 10:22
Avatar de skywolker
skywolker
 
Fecha de Ingreso: julio-2011
Ubicación: España
Mensajes: 195
Antigüedad: 12 años, 9 meses
Puntos: 8
Respuesta: Subir imagen y transformar a miniatura mysql

Hay tiene usted su código image resize cambie el tamaño de su imagen a su gusto y guárdelo en su base de datos mysql


Código PHP:
<?php
function resizeImage($imagePath$width$height$filterType$blur$bestFit$cropZoom) {
    
//The blur factor where &gt; 1 is blurry, &lt; 1 is sharp.
    
$imagick = new Imagick(realpath($imagePath));

    
$imagick->resizeImage($width$height$filterType$blur$bestFit);

    
$cropWidth $imagick->getImageWidth();
    
$cropHeight $imagick->getImageHeight();

    if (
$cropZoom) {
        
$newWidth $cropWidth 2;
        
$newHeight $cropHeight 2;

        
$imagick->cropimage(
            
$newWidth,
            
$newHeight,
            (
$cropWidth $newWidth) / 2,
            (
$cropHeight $newHeight) / 2
        
);

        
$imagick->scaleimage(
            
$imagick->getImageWidth() * 4,
            
$imagick->getImageHeight() * 4
        
);
    }


    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

?>