Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/10/2006, 14:01
charlierun
 
Fecha de Ingreso: enero-2006
Mensajes: 51
Antigüedad: 18 años, 3 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