Mohl by mi někdo poradit jak bych mohl upravit tento skript na hromadný upload fotek, např pomocí 5 formulářů
<?php
include "config.php";
mysql_query("SET NAMES UTF8");
$galerie = $_GET["galerie"];
$rand = rand(10,999);
function seo ($title){
$address = $title;
$address = Strtr($address, "áÁéÉíÍóÓúÚůŮýÝěĚšŠčČřŘžŽťŤďĎňŇ ", "aAeEiIoOuUuUyYeEsScCrRzZtTdDnN-");
$address = strtolower ($address);
$re = "/[^[:alpha:][:digit:]]/";
$replacement = "-";
$address = preg_replace ($re, $replacement, $address);
$address = trim ($address, "-");
$re = "/[-]+/";
$replacement = "-";
$address = preg_replace ($re, $replacement, $address);
return $address;
}
// ------------------------------------------------- ZPRACOVÁNÍ DOTAZŮ -------------------------------------------------------------------
// UPLOAD FOTKY
if (isset ($_POST['pridat_fotku'])){
if (!$pridat_fotku_gal) {
die ("<p>Nevybrali jste galerii pro upload obrázku nebo nezadali název fotky !<a href=\"index.php?q=galerie_admin\">Zpět do administrace galerie.</a></p>");
}
if ($soubor_type == "text/plain" || $soubor_type="text/html")
{
if(($pridat_fotka)=="") echo"cyhby";
if (move_uploaded_file ($soubor, "./img/fotky/".$nazev."_o.jpg"))
{
$filename = "./img/fotky/".$nazev."_o.jpg";
$array = getimagesize($filename);
$width_orig= $array[0];
$height_orig= $array[1];
if($width_orig > $height_orig) {$width= 180; $height= 135;}
else {$height= 180; $width= 135;}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, "./img/fotky/".$nazev."_m.jpg", 80);
mysql_query("INSERT INTO fotky (seo_nazev, seo_gal, nazev) values ('$nazev', '$pridat_fotku_gal', '".$_POST['pridat_fotka']."')");
if (($width_orig > 800)and($width_orig > $height_orig)) {
$width = 800; $height = 800 / $width_orig * $height_orig;
$image_p = imagecreatetruecolor($width, $height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, "./img/fotky/$nazev.jpg", 80);
}
elseif (($height_orig > 700)and($width_orig < $height_orig)){
$height = 700; $width = 700 / $height_orig * $width_orig;
$image_p = imagecreatetruecolor($width, $height);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, "./img/fotky/$nazev.jpg", 80);
}
else {
$image_p = imagecreatetruecolor($width_orig, $height_orig);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width_orig, $height_orig, $width_orig, $height_orig);
imagejpeg($image_p, "./img/fotky/".$nazev.".jpg", 80);
}
unlink($filename);
echo "<p>Fotka <strong>".$_POST['pridat_fotka'].".jpg</strong> byla úspěšně nahrána do galerie.</p>";
}else {echo "<p>Soubor nemohl být nahrán, zřejmě došlo k chybě!</p>";}*/
}else {echo "<p><strong>Zadali jste špatný typ souboru!</strong></p>";}
// ------------------------------------------------- FORMULÁŘE -------------------------------------------------------------------
$sql = mysql_query("SELECT * FROM galerie ORDER BY id DESC");
while ($q = mysql_fetch_array($sql)):
$fotoid = $q["id"];
$seo_gal = $q["seo_gal"];
$nazev = $q["nazev"];
echo "<input type=\"radio\" name=\"pridat_fotku_gal\" value=\"$seo_gal\" /> $nazev\n";
endwhile; // PŘIDAT FOTKU
echo"<form action=\"\" method=\"post\" enctype=\"multipart/form-data\">";
for($i=0;$i<=5;$i++){
echo("<h2 class=\"gal_admin\">Přidat fotku</h2>
<input type=\"file\" name=\"soubor\" /> \n");
echo ("
Název fotky: <input type=\"text\" name=\"pridat_fotka\" value=\"\" size=\"30\" class=\"pole\" />
<hr />\n");
}
echo"<input type=\"submit\" value=\"Nahrát\" name=\"pridat_fotku\" />
</form>";