Esta es la funcion dentro de config.php:
Código php:
Ver originalfunction redimensionar_jpeg($img_original, $img_nueva, $img_nueva_anchura, $img_nueva_altura, $img_nueva_calidad)
{
ImageJPEG($thumb,$img_nueva,$img_nueva_calidad); }
y esta es el script igaleria:
Código php:
Ver original<?php
require("config.php");
if(isset($_SESSION["usuadmin"])){ if(isset($_POST["galeria"])== FALSE){ $nombre=make_Safe($_POST["nombre"]);
$fecha=make_Safe($_POST["fecha"]);
$sql0="INSERT INTO ".$sqlbd.".albumes(id, nombre, fecha) VALUES(NULL,'".$nombre."','".$fecha."');";
$sql1="SELECT albumes.id FROM albumes ORDER BY albumes.id DESC LIMIT 0,1;";
for($cont=0;$cont<5;$cont++){
$origen=$_FILES['userfile'.$cont]['tmp_name'];
$destino="ImgSml/".$last_album[0]."_".$cont."_sml.jpg";
$destino2="ImgBig/".$last_album[0]."_".$cont."_big.jpg";
$destino_temporal=tempnam("tmp/","tmp"); $type=$_FILES['userfile'.$cont]['type'];
$neww = 122;
$newh = 95;
if($type=="image/jpeg"){
redimensionar_jpeg($origen, $destino_temporal, $neww, $newh, 200);
$sql="INSERT INTO `".$sqlbd."`.`fotos` (`id` ,`id_album` ,`direccion_sml` ,`direccion_big`)VALUES ('NULL', '".$last_album[0]."', '".$destino."', '".$destino2."');";
}
}
for($cont=0;$cont<5;$cont++){
$des = 0.20;
$origen=$_FILES['userfile'.$cont]['tmp_name'];
$destino="ImgBig/".$last_album[0]."_".$cont."_big.jpg";
$destino_temporal=tempnam("tmp/","tmp"); $type=$_FILES['userfile'.$cont]['type'];
$neww = $width * $des;
$newh = $height * $des;
if($type=="image/jpeg"){
redimensionar_jpeg($origen, $destino_temporal, $neww, $newh, 200);
}
}
header("Location: ".$basedir."iniadmin.php"); }
else{
$album = $_POST["galeria"];
$sqla = "SELECT id FROM albumes WHERE nombre = '".$album."';";
$sqln = "SELECT id FROM fotos WHERE id_album = '".$id[0]."';";
for($cont=0;$cont<5;$cont++){
$num2 = $cont+$num;
$origen=$_FILES['userfile'.$cont]['tmp_name'];
$destino="ImgSml/".$id[0]."_".$num2."_sml.jpg";
$destino2="ImgBig/".$id[0]."_".$num2."_big.jpg";
$destino_temporal=tempnam("tmp/","tmp"); $type=$_FILES['userfile'.$cont]['type'];
$neww = 122;
$newh = 95;
if($type=="image/jpeg"){
redimensionar_jpeg($origen, $destino_temporal, $neww, $newh, 200);
$sql="INSERT INTO `".$sqlbd."`.`fotos` (`id` ,`id_album` ,`direccion_sml` ,`direccion_big`)VALUES ('NULL', '".$id[0]."', '".$destino."', '".$destino2."');";
}
}
for($cont=0;$cont<5;$cont++){
$num3 = $cont+$num;
$des = 0.20;
$origen=$_FILES['userfile'.$cont]['tmp_name'];
$destino="ImgBig/".$id[0]."_".$num3."_big.jpg";
$destino_temporal=tempnam("tmp/","tmp"); $type=$_FILES['userfile'.$cont]['type'];
$neww = $width * $des;
$newh = $height * $des;
if($type=="image/jpeg"){
redimensionar_jpeg($origen, $destino_temporal, $neww, $newh, 200);
}
}
header("Location: ".$basedir."iniadmin.php"); }
}
else{
header("Location: ".$basedir); }
?>