No mi sugerencia es que crees un
Código:
<form name="addPict" action="resize.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="2048000">
<input type="file" name="srcImg" size="60">
</form>
Luego cuando des submit en el php haces un codigo algo similar
resize.php
Código PHP:
<?php
include("class_resize.php");
foreach($_REQUEST as $key => $value){
$$key = $value;
}
foreach($_FILES as $key => $value){
foreach($value as $key2 => $value2){
//echo $key2 . " - " . $value2."<br />";
if($key2 == "name"){
$srcImg = $value2;
}
if($key2 == "tmp_name"){
$srcImg_tmp = $value2;
}
if($key2 == "type"){
$srcImg_type = $value2;
}
}
}
if(isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH']> 2048000){
$action = 'index.php?error=Upload FAILED, file is too large!';
header("Location: $action");
die();
}
$txtname = strtolower(basename($srcImg));
$getExplName = explode(".", $txtname);
$txtname = $_COOKIE["ID_Cookie"] . "." . $getExplName[1];
$result = @move_uploaded_file($srcImg_tmp, $txtname);
$imgTrans = new imageTransform();
$imgTrans->sourceFile = $txtname;
$imgTrans->targetFile = "directorio/".$txtname;
$imgTrans->resizeToHeight = 200;
//Puedes tambien modificar el width
//$imgTrans->resizeToWidth = 200;
$imgTrans->resize();
@unlink($txtname);
?>