← Back
Editing: processform.php
<?php require_once ("../funct.php"); require_once ("sess.php"); require_once ("conn.php"); $id_galleria = $_REQUEST['id_galleria'] ? $_REQUEST['id_galleria'] : 1; $query = new doQuery (); $strPath = "/var/www/vhosts/smartmedia2000.it/httpdocs/accommod/foto_temp/"; $save_path = $_POST['save_path']; function rotateAndSave ($imgfile, $degrees) { $degrees = 360 - $degrees; // The file you are rotating $image = $imgfile; print_r($image);exit(); // Create the canvas $source = imagecreatefromjpeg($image) ; // Rotates the image $rotate = imagerotate($source, $degrees, 0) ; // Outputs a jpg image, you could change this to gif or png if needed imagejpeg($rotate, $imgfile, 90); } $count = $_POST['imCounter']; for ($i=1; $i<=$count; $i++) { $rotateby = $_POST['imgRotation' . $i]; $file_name = str_replace (' ', '_', $_POST['description'.$i]); # nomi senza spazi //$file_name_esc = str_replace (' ', '\ ', $_POST['description'.$i]); $file_name_esc = $_POST['description'.$i]; $actualFileName = $save_path.$file_name; exec ("chmod 666 ".$strPath.$file_name_esc); # trasferisce la foto al suo posto // $out = system ("mv ".$strPath.$file_name_esc." ".$actualFileName); copy ($strPath.$file_name_esc, $actualFileName); //echo "$out <br />$strPath $file_name_esc <br /> $actualFileName";exit(); if($rotateby > 0) rotateAndSave ($actualFileName, $rotateby); # recupera la dimensione stabilita delle foto da inserire $sqlD = "SELECT `dim_thumb`, `dim_foto`, `dim_grande` FROM `utenti` WHERE `id` = $id_utente"; $rowD = $query->freeQuery ($sqlD, 0); # metodo primitivo per lo slideshow if ($id_utente == 20) $note = "slide"; if ($id_galleria > 2) { # azioni per gallerie $dim_foto = $rowD[0]->dim_grande; $dim_grande = 0; # recupera l'ordine massimo $sqlO = "SELECT MAX(ordine) AS `ordine` FROM `foto` WHERE `id_galleria`= $id_galleria"; $rowO = $query->freeQuery ($sqlO, 0); $ordine = ($rowO[0]->ordine)+1; } else {# azioni per pagine interne $dim_foto = $rowD[0]->dim_foto; $dim_grande = $rowD[0]->dim_grande; $ordine = 0; } $out = resampleImg ($file_name, $dim_foto, $rowD[0]->dim_thumb, $dim_grande, $note); $query->freeQuery ("INSERT INTO `foto` (`id_utente`, `foto`, `id_galleria`, `ordine`) VALUES ($id_utente, '$file_name', '$id_galleria', '$ordine')", 0); //echo $out;die; } if ($id_galleria > 2) header ("Location: fotogallerie_ed.php?id_galleria=".$id_galleria."&uplFl=y"); else header ("Location: foto_ed.php?uplFl=y"); ?>
Save File
Cancel