Dopo letteralmente 7 ore che cerco di smanettare sul codice php senza successo devo chiedervi aiuto.
Mobilewebcam non ruota correttamente ovvero se metto il telefono con la fotocamera sulla destra mi carica le immagini al contrario e non riesco a modificare il codice per farglielo fare ci stò uscendo pazzo e ho perso tutta la giornata su questo codice
mi potete dire come modificarlo per fergli ruotare l'immagine uppata? grazie.
A questa è la webcam aggiornata ogni 2 minuti
http://www.nicolafenaroli.com/webcam/current.jpgCodice: Seleziona tutto
<?php
// new file uploaded? copy to $root_dir; create thumbnail;
// version 1.04, 12/30/2012;
$uploadfile = "";
$today = date ("Y-m-d", time());
// all archives are in "root_dir" of the gallery
$root_dir = "archive";
// every day a new directory archive/2012-09-08, archive/2012-09-09, ...
$working_dir = $root_dir."/$today";
// create thumbnails in directory archive/2012-09-08/thumbnails"
$thumbdir = $working_dir."/thumbnails";
$thumbnail_width=240;
$thumbnail_height=180;
if (empty($_FILES["userfile"]["name"]))
{
echo "no upload file\n";
exit;
}
if(strlen(basename($_FILES["userfile"]["name"])) > 0)
{
$uploadfile = basename($_FILES["userfile"]["name"]);
if(!file_exists($root_dir))
{
mkdir($root_dir, 0777);
}
if(!file_exists($working_dir))
{
mkdir($working_dir, 0777);
}
if(!file_exists($thumbdir))
{
mkdir($thumbdir, 0777);
}
if(move_uploaded_file($_FILES["userfile"]["tmp_name"], $uploadfile))
{
# check filetype, must be IMAGETYPE_JPEG
if (exif_imagetype($uploadfile) != 2)
{
echo "ERROR: FileType != 2";
exit;
}
@chmod($uploadfile,0755);
//$filename = filemtime($uploadfile).".jpg";
$filename = time().".jpg";
$archivefile = $working_dir."/".$filename;
$smallname = $thumbdir."/".$filename;
copy($uploadfile, $archivefile);
if ($uploadfile <> 'current.jpg')
{
rename ($uploadfile, 'current.jpg');
}
echo "Upload Ok! ";
if(!file_exists($smallname))
{
$image = @imagecreatefromjpeg($archivefile);
if($image)
{
$new_image = imagecreatetruecolor($thumbnail_width, $thumbnail_height);
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, imagesx($image), imagesy($image));
imagejpeg($new_image, $smallname);
echo "Thumbnail Ok! ";
}
else
{
echo "Error create thumbnail!<br>";
}
}
}
else
echo "Error create archive-file!<br>";
}
?>