Autor Zpráva
Lopyn
Profil
Čus všichni, mám tu problém s timhle skriptem. Záhadou je že se mi normálně zobrazí imageThumbnail created succesful!, ale neuploadne se mi ani obrázek. chmod 777 je nastavenej. jinak to nepíše nic jinýho...když sem skript upravil bez miniatury tak mi upload fungoval

<?
session_start();
if ($_SESSION['login']==1)
{
$cesta = "./obrupl/"; // Path To Images Directory
$cestamin ="./obruplmin/";

$twidth = "125"; // Maximum Width For Thumbnail Images

$theight = "100"; // Maximum Height For Thumbnail Images
$docasny=$_FILES['upload']['name'];
$nazev=$cesta . $docasny;
if(move_uploaded_file($_FILES['upload']['tmp_name'],$nazev)) {

list($sirka,$vyska,$typ,$atributy)=getimagesize($nazev);
if($typ>3)
{
echo'ERROR: Wrong filetype (has to be a .jpg or .jpeg or gif or pgn. Yours is ';
$file_ext = strrchr($_FILES['upload']['name'], '.');
echo $file_ext;
}
else
{
$spojeni=mysql_connect("mysql.hu.cz","****","****") or die ("check spojeni");

mysql_select_db("hu_phptester");
if($rozh=="Jednotlivá čísla")
{
$nadpis=$_POST['nadpis'];
$vlozit="INSERT INTO cislaobsah(cas,mesic,rok,text,nadpis) VALUES ('$cas','$mesic','$rok','$textarea','$nadpis')";
}
else
{
$vlozit="INSERT INTO cislaslovo(cas,mesic,rok,text) VALUES ('$cas','$mesic','$rok','$textarea')";
}
$vysledky=mysql_query($vlozit)or die(mysql_error());
//session_unset($_SESSION['cas']);


if($typ==2)
{
rename($nazev,$novynazev);
}
else
{
if($typ==1)
{
$staryobr=imagecreatefromgif($nazev);
}
elseif($typ==3)
{
$staryobr=imagecreatefrompng($nazev);
}

$idobr=mysql_insert_id();
$novynazev=$cesta . $idobr.".jpg";

$obrazek_jpg = imagecreate($sirka,$vyska);
imagecopyresampled($obrazek_jpg,$staryobr,0,0,0,0,$sirka,$vyska,$sirka ,$vyska);
imagejpeg($obrazek_jpg,$novynazev);
imagedestroy($staryobr);
imagedestroy($obrazek_jpg);
}
$url=$idobr.".jpg";
$simg = imagecreatefromjpeg("$cesta" . $url); // Make A New Temporary Image To Create The Thumbanil From

$currwidth = imagesx($simg); // Current Image Width

$currheight = imagesy($simg); // Current Image Height

if ($currheight > $currwidth) { // If Height Is Greater Than Width

$zoom = $twidth / $currheight; // Length Ratio For Width

$newheight = $theight; // Height Is Equal To Max Height

$newwidth = $currwidth * $zoom; // Creates The New Width

} else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)

$zoom = $twidth / $currwidth; // Length Ratio For Height

$newwidth = $twidth; // Width Is Equal To Max Width

$newheight = $currheight * $zoom; // Creates The New Height

}

$dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail

imagetruecolortopalette($simg, false, 256); // Create New Color Pallete

$palsize = ImageColorsTotal($simg);

for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image

$colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used

ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use

}

imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It)

imagejpeg($dimg, $novynazev); // Saving The Image

imagedestroy($simg); // Destroying The Temporary Image

imagedestroy($dimg); // Destroying The Other Temporary Image

print 'Image thumbnail created successfully.'; // Resize successful

}
}
Lopyn
Profil
už jsem na to přišel sem. jestil se o to někdo pokoušel tak díky

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0