My code is currently playing its part well up and putting the watermark on upload images, but I would like to be storing the names of all images in the database.
$idnoticia = $_GET['idnoticia'];
$watermark = imagecreatefrompng('watermark.png');
$watermark_x = imagesx($watermark);
$watermark_y = imagesy($watermark);
$dir = "../img/$idnoticia/";
foreach($_FILES['files']['tmp_name'] as $index => $file) {
$image = imagecreatefromjpeg($file);
imagecopy($image, $watermark, round(imagesx($image) / 1) - round($watermark_x / 1), round(imagesy($image) / 1) - round($watermark_y / 1), 0, 0, $watermark_x, $watermark_y);
imagejpeg($image, $dir . preg_replace('/.jpeg|.jpg/i', '', $_FILES['files']['name'][$index]) . '_wm.jpg');
imagedestroy($image);
}
imagedestroy($watermark);
echo "Envio Completado!";
$sqlInsert = 'UPDATE noticias SET galeria = "$image" WHERE idnoticia = "$idnoticia';
$stmt = DB::prepare($sqlInsert2);
$stmt->bindParam("galeria", $image);
$stmt->execute();
I would like to store the names of the images in the galeria
field as (img1.jpg, img2.jpg, img3.jpg), placing a delimiter for when to display facilitate.
Is it possible?