es que estoy haciendo una pagina de álbum de foto y quiero que cuando tenga un porcentaje de fotos el cree álbum pero tengo la idea y no he sabido plasmarla este es mi cod
Código PHP:
<?php
require('Conection.php');
if ($foto= $FILES['dropzone']['name']<=200) {
mkdir("Imagenes/album/fotos", 0777);
foreach ($_FILES as $key) //Iteramos el arreglo de archivos
{
if($key['error'] == UPLOAD_ERR_OK )//Si el archivo se paso correctamente Ccontinuamos
{
$foto= $key['name'];
$tipo=$key['type'];
$ruta=$key['tmp_name'];
$size=$key['size'];
$prefijo = substr(md5(uniqid(rand())),0,6);
//generamos una id para poder tener imagenens repetidas
$destino='../Imagenes/album/'.$prefijo."_".$foto;
move_uploaded_file($ruta,$destino);
$ruta_imagen=$destino;
$width= 1000;
$heigth= 700;
list($imagen_ancho, $imagen_alto) =getimagesize($ruta_imagen);
$imagen = imagecreatefromjpeg($ruta_imagen);
$lienzo = imagecreatetruecolor($width,$heigth);
imagecopyresampled($lienzo, $imagen, 0, 0, 0, 0,$width, $heigth, $imagen_ancho, $imagen_alto);
imagejpeg($lienzo,$ruta_imagen,100);
//Creamos la miniaturas
$source=$destino;
$destmini='../Imagenes/img/'.$prefijo."_".$foto;//ruta donde se guardan las miniaturas
$width_d=240; // ancho de la imagen
$height_d=240; // alto de la imagen
//copyamos la miniatura
list($width_s, $height_s) = getimagesize($source);
$gd_s = imagecreatefromjpeg($source);
$gd_d = imagecreatetruecolor($width_d, $height_d);
imagecopyresampled($gd_d, $gd_s, 0, 0, 0, 0, $width_d, $height_d, $width_s, $height_s);
imagejpeg($gd_d, $destmini,50);
$query = "INSERT INTO subir_imagen(imagen,ruta_min)VALUES ('$destino,'$destmini')";
$result0=mysqli_query( $conexion,$query) or die(mysqli_error($conexion));
}
}
}else{
echo '{"status":"error"}';
exit;
}