Viewing file: index_noticia.php (2.77 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $pagina_actual="administrar-fotos-novedades"; $categoria_actual="novedades"; $base="../../../"; require_once($base."includes/config.php"); require_once($base."includes/funciones.php");
error_reporting(E_ALL | E_STRICT); require('UploadHandler.php'); $upload_handler = new UploadHandler();
$mensaje="";
//ob_start(); /*
echo "POST" ;
print_r($_POST);
echo "FILES" ;
*/
//print_r($_FILES);
if (isset($_FILES["files"]["tmp_name"])){
$id=cadena_segura($_SESSION["id_ultima_noticia"],11);
//$imgUrl = $_FILES["files"]["tmp_name"][0];
$imgUrl = "files/".$_FILES["files"]["name"][0];
switch(strtolower($_FILES["files"]['type'][0])) { case 'image/png': //$img_r = imagecreatefrompng($imgUrl); $source_image = imagecreatefrompng($imgUrl); $type = '.png'; break; case 'image/jpeg': //$img_r = imagecreatefromjpeg($imgUrl); $source_image = imagecreatefromjpeg($imgUrl); //error_log("jpg"); $type = '.jpeg'; break; case 'image/gif': //$img_r = imagecreatefromgif($imgUrl); $source_image = imagecreatefromgif($imgUrl); $type = '.gif'; break; default: die('image type not supported'); }
$timestamp=time()-rand(1, 1500);
//echo $imgUrl;
//echo $base.$carpeta_noticias_thumb.$timestamp.$type;
//copy($imgUrl, $base.$carpeta_noticias_thumb.$timestamp.$type);
// Load the stamp and the photo to apply the watermark to
//$stamp = imagecreatefrompng($base.'../contenido/marca_agua.png'); $im = imagecreatefromjpeg($imgUrl);
// Set the margins for the stamp and get the height/width of the stamp image /* $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp);
$imgx = imagesx($im); $imgy = imagesy($im); $centerX=round($imgx/2)-round($sx/2); $centerY=round($imgy/2)-round($sy/2);
// Copy the stamp image onto our photo using the margin offsets and the photo // width to calculate positioning of the stamp. imagecopy($im, $stamp, $centerX, $centerY, 0, 0, imagesx($stamp), imagesy($stamp)); */ imagejpeg($im, $imgUrl, 100);
generar_imagen($imgUrl,$ancho_novedades_original,$alto_novedades_original,$base.$carpeta_novedades_original.$timestamp.$type);//genero la grande generar_imagen($imgUrl,$ancho_novedades_thumb,$alto_novedades_thumb,$base.$carpeta_novedades_thumb.$timestamp.$type);//genero la grande $nombre_archivo=$timestamp.$type;
//echo $im,$ancho_noticias_thumb,$alto_noticias_thumb,$base.$carpeta_noticias_thumb.$timestamp.$type;
$mensaje = ob_get_clean();
$result=$mysqli->query(" INSERT INTO foto_novedad (id_novedad, nombre, orden) VALUES ( '$id', '".$nombre_archivo."', '".$timestamp."' )"); //hasta aca
unlink($imgUrl);
//mail("posicionamiento@creadoresdesitios.com.ar","test subir",$mensaje,"From: posicionamiento@creadoresdesitios.com.ar");
}
|