1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
if(isset( $Submit ))
{
echo $_FILES['imagefile']['type'] . "<br>";
if ($_FILES['imagefile']['type'] == "image/pjpeg"){
if (move_uploaded_file($_FILES['imagefile']['tmp_name'], $uploaddir . "$ref.jpg"))
{
$new_pic = $ref . ".jpg";
echo "<br>";
echo "Name: ".$_FILES['imagefile']['name']."<br>";
echo "Size: ".$_FILES['imagefile']['size']."<br>";
echo "Type: ".$_FILES['imagefile']['type']."<br>";
echo "La copie a reussie....";
if(empty($_GET['s'])) {
$new_thumb = "TN_$new_pic";
$sourcefile = "$uploaddir$new_pic";
$picsize = getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];
$ratio = $source_x/$source_y;
$dest_x = 100;
$dest_y = $dest_x/$ratio;
$targetfile = "$uploaddir$new_thumb";
$jpegqual = 75;
$source_id = imagecreatefromjpeg("$sourcefile");
$target_id = imagecreate($dest_x, $dest_y);
$target_pic = imagecopyresized($target_id,$source_id,0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
imagejpeg($target_id,"$targetfile",$jpegqual);
echo "Miniaturisation reussie !<br>";
?>
<div style="clear: both;">
<a href="http://www.nice-antiques.com/img/<?=$new_pic?>">
<img src="http://www.nice-antiques.com/img/<?=$new_thumb?>" style="float: left" />
</a>
<strong><?=$_FILES['imagefile']['name']?></strong><br /><br />
<strong>Name:</strong><br />
</div>
<?php
}
}
}
else {
echo "";
echo "Impossible de copier le fichier : mauvais type d'image (".$_FILES['imagefile']['name'].")";
}
} |
Partager