Foros del Web » Programando para Internet » PHP »

urge ayuda redimensionar en php

Estas en el tema de urge ayuda redimensionar en php en el foro de PHP en Foros del Web. hola estoy haciendo un upload image en flash y este es el php sencillo ke solo sube la imagen a una carpeta ke le indico ...
  #1 (permalink)  
Antiguo 05/10/2006, 14:01
 
Fecha de Ingreso: enero-2006
Mensajes: 51
Antigüedad: 18 años, 2 meses
Puntos: 0
urge ayuda redimensionar en php

hola estoy haciendo un upload image en flash y este es el php sencillo ke solo sube la imagen a una carpeta ke le indico desde flash:
Código PHP:
<?
if ($_REQUEST['uploadDir']) {
    
$uploadDir $_REQUEST['uploadDir'];
    
$uploadFile $uploadDir $_FILES['Filedata']['name'];
    
move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadFile);
}

if (
$_REQUEST['action'] == 'getMaxFilesize') {
    echo 
"&maxFilesize=".ini_get('upload_max_filesize');
}
?>
pero ahora necesito hacer una copia redimensionada de esa imagen y utilizo este codigo a habido un momento ke iba estupendamente pero ahora no hace nada si alguien pudiera hecharle un ojo y decirme ke hago mal seria maravilloso este es el codigo

<?php
if ($_REQUEST['uploadDir']) {
$uploadDir = $_REQUEST['uploadDir'];


$size = 300; // the thumbnail height

$filedir = 'hola/'; // the directory for the original image
$thumbdir = 'hola/'; // the directory for the thumbnail image
$prefix = 'small_'; // the prefix to be added to the original name

$maxfile = '2000000000';
$mode = '0666';

$userfile_name= $_FILES['Filedata']['name'];
$userfile_tmp = $_FILES['Filedata']['tmp_name'];
$userfile_size = .$_FILES['Filedata']['size'];
$userfile_type = $_FILES['Filedata']['type'];

if (isset($_FILES['Filedata']['name']))
{
$prod_img = $filedir.$userfile_name;

$prod_img_thumb = $thumbdir.$prefix.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));

$sizes = getimagesize($prod_img);

$aspect_ratio = $sizes[1]/$sizes[0];

if ($sizes[1] <= $size)
{
$new_width = $sizes[0];
$new_height = $sizes[1];
}else{
$new_height = $size;
$new_width = abs($new_height/$aspect_ratio);
}

$destimg=ImageCreateTrueColor($new_width,$new_heig ht)
or die('Problem In Creating image');
$srcimg=ImageCreateFromJPEG($prod_img)
or die('Problem In opening Source Image');
if(function_exists('imagecopyresampled'))
{
imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_w idth,$new_height,ImageSX($srcimg),ImageSY($srcimg) )
or die('Problem In resizing');
}else{
Imagecopyresized($destimg,$srcimg,0,0,0,0,$new_wid th,$new_height,ImageSX($srcimg),ImageSY($srcimg))
or die('Problem In resizing');
}
ImageJPEG($destimg,$prod_img_thumb,90)
or die('Problem In saving');
imagedestroy($destimg);
}


if ($_REQUEST['action'] == 'getMaxFilesize') {
echo "&maxFilesize=".ini_get('upload_max_filesize') ;
}
?>

gracias
  #2 (permalink)  
Antiguo 05/10/2006, 14:25
 
Fecha de Ingreso: enero-2006
Mensajes: 51
Antigüedad: 18 años, 2 meses
Puntos: 0
solucionado...............................
  #3 (permalink)  
Antiguo 12/11/2006, 18:31
 
Fecha de Ingreso: mayo-2005
Mensajes: 10
Antigüedad: 18 años, 10 meses
Puntos: 0
como lo has solucionado??
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:06.