Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/08/2008, 12:03
manzarinaa
 
Fecha de Ingreso: noviembre-2007
Mensajes: 382
Antigüedad: 16 años, 5 meses
Puntos: 16
Respuesta: Problema con la libreria GD en php 4

Hola
mira a ver si te puede ayudar este codigo en algo
lo he usado en servidor php5 y funciona, tammbien con las gd

Código:
 if ($image_size = @getimagesize($src)) {

            $ratio = $image_size[1] / $image_size[0];

            // Set the width and height to the proper ratio
            if (!$width && $height) {
                $ratio = $height / $image_size[1];
                $width = intval($image_size[0] * $ratio);
            } elseif ($width && !$height) {
                $ratio = $width / $image_size[0];
                $height = intval($image_size[1] * $ratio);
            } elseif (!$width && !$height) {
                $width = $image_size[0];
                $height = $image_size[1];
            }

            // Scale the image if not the original size
            if ($image_size[0] != $width || $image_size[1] != $height) {
                $rx = $image_size[0] / $width;
                $ry = $image_size[1] / $height;

                if ($rx < $ry) {
                    $width = intval($height / $ratio);
                } else {
                    $height = intval($width * $ratio);
                }

                $image = '<img src="product_thumb.php?img=' . $src . '&w=' .
                tep_output_string($width) . '&h=' . tep_output_string($height) . '"';
            }
es una contribución de oscomerce, a mi me funciona bien, si te quieres mirar el código completo busca en la pagina de oscommerce otf autothumb v2.4fix3