Proyectos de Subversion LeadersLinked - Services

Rev

Rev 781 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 781 Rev 784
Línea 1054... Línea 1054...
1054
            return false;
1054
            return false;
1055
        }
1055
        }
1056
    }
1056
    }
Línea 1057... Línea 1057...
1057
 
1057
 
-
 
1058
    /**
-
 
1059
     * Redimensiona una imagen manteniendo su proporción original.
-
 
1060
     * La imagen resultante tendrá las dimensiones que mejor se ajusten 
1058
    /**
1061
     * dentro de los límites especificados sin recortar contenido.
1059
     *
1062
     *
1060
     * @param string $source
1063
     * @param string $source_filename Ruta del archivo de imagen fuente
1061
     * @param string $target_filename
1064
     * @param string $target_filename Ruta donde guardar la imagen redimensionada
1062
     * @param number $target_width
1065
     * @param int $target_width Ancho máximo deseado
1063
     * @param number $target_height
1066
     * @param int $target_height Alto máximo deseado
1064
     * @return boolean
1067
     * @return boolean True si se redimensionó correctamente, false en caso de error
1065
     */
1068
     */
1066
    public function uploadImageResize($source_filename, $target_filename, $target_width, $target_height)
1069
    public function uploadImageResize($source_filename, $target_filename, $target_width, $target_height)
1067
    {
1070
    {
1068
        try {
1071
        try {
Línea 1084... Línea 1087...
1084
                }
1087
                }
Línea 1085... Línea 1088...
1085
 
1088
 
1086
                $resized_width = round($resized_width);
1089
                $resized_width = round($resized_width);
Línea 1087... Línea 1090...
1087
                $resized_height = round($resized_height);
1090
                $resized_height = round($resized_height);
1088
 
1091
 
1089
                $new_image = $this->_createImageCanvas($target_width, $target_height);
1092
                $new_image = $this->_createImageCanvas($resized_width, $resized_height);
1090
                if ($new_image === false) {
1093
                if ($new_image === false) {
1091
                    imagedestroy($img);
1094
                    imagedestroy($img);
1092
                    unlink($source_filename);
1095
                    unlink($source_filename);