ciao gente.
ho scorperto dell'esistenza del limite dell'upload dei 3Mb.
mi sapreste suggerire come modificare il mio script perchè modifichi le immagini prima di arrivare al blocco dell'invio?
parte in cui prelevo il file dal pc e lo inietto in altervista ;)
Codice PHP:
while ($k <= $up){
$t = $_FILES["file$k"]['tmp_name'];
$sz = $_FILES["file$k"]['size'];
$n = $_FILES["file$k"]['name'];
if ($t == 'none'){
echo "Non hai selezionato alcuna immagine da inviare";
}
else {
if($t != '' && $n != ''){
$red = new thumbnail;
$lrgImage = $red->generate('I',$t, $n, $dest, $n, 800); // ridimensiona l'immagine
ridimensionatore:
Codice PHP:
class thumbnail
{
var $tipo; //mia aggiunta per forzare la creazione dei thumbnasil
var $sourceFile; // We use this file to create the thumbnail
var $originalFilename; // We use this to get the extension of the filename
var $destinationDirectory; // The Directory in question
var $destinationDirectoryFilename; // The destination filename
var $createImageFunction = '';
var $outputImageFunction = '';
function generate($tipo ="", $sourceFile = "", $originalFilename = "", $destinationDirectory = "", $destinationDirectoryFilename = "", $width = -1, $height = -1)
{
if (!empty($sourceFile))
$this->sourceFile = $sourceFile;
if (!empty($originalFilename))
$this->originalFilename = $originalFilename;
if (!empty($destinationDirectory))
$this->destinationDirectory = $destinationDirectory;
if (!empty($destinationDirectoryFilename))
$this->destinationDirectoryFilename = $destinationDirectoryFilename;
if (!empty($width))
$this->width = $width;
if (!empty($height))
$this->height = $height;
list(, $this->extension) = explode('.', $this->originalFilename);
switch ($this->extension)
{
case 'gif' : case 'GIF':
$createImageFunction = 'imagecreatefromgif';
$outputImageFunction = 'imagegif';
break;
case 'png' : case 'PNG':
$createImageFunction = 'imagecreatefrompng';
$outputImageFunction = 'imagepng';
break;
case 'bmp' : case 'BMP':
$createImageFunction = 'imagecreatefromwbmp';
$outputImageFunction = 'imagewbmp';
break;
case 'jpg': case 'jpeg': case 'JPG' : case 'JPEG':
$createImageFunction = 'imagecreatefromjpeg';
$outputImageFunction = 'imagejpeg';
break;
default :
exit("Errore: il formato '{$this->extension}' non è supportato");
break;
}
$this->img = $createImageFunction($this->sourceFile);
list($this->org_width, $this->org_height) = getimagesize($this->sourceFile);
if($tipo == 'I'){
if (($this->org_height > 480) && ($this->org_width > 640)){
if ($this->height == -1){
$this->height = round($this->org_height * $this->width / $this->org_width);
}
if ($this->width == -1){
$this->width = round($this->org_width * $this->height / $this->org_height);
}
}
else{
$this->height = $this->org_height;
$this->width = $this->org_width;
}
}
if($tipo == 'T'){
if ($this->height == -1){
$this->height = round($this->org_height * $this->width / $this->org_width);
}
if ($this->width == -1){
$this->width = round($this->org_width * $this->height / $this->org_height);
}
}
$this->xoffset = 0;
$this->yoffset = 0;
$this->img_new = imagecreatetruecolor($this->width, $this->height);
if ($this->img_new)
{
imagecopyresampled($this->img_new, $this->img, 0, 0, $this->xoffset, $this->yoffset, $this->width, $this->height, $this->org_width, $this->org_height);
list($this->newFilename) = explode('.', $this->destinationDirectoryFilename);
$this->fullDestination = ($this->destinationDirectory.'/'.$this->newFilename.'.'.$this->extension);
$outputImageFunction($this->img_new, $this->fullDestination);
}
else
{
$this->failed = true;
}
if ($this->failed == false)
{
return $this->fullDestination;
}
}
}
?>
grais