Autor Zpráva
kachnak
Profil *
prosim vas skusam spravit nieco na zmensenie obrazkov a v IE funguje kod ale v mozile pise chybu:
the image "http://www.bmxer.xf.cz/skuska/novyodkaz.php" cannot by displayed because it contain errors

prosim neviete co je tam zle aby to islo ja v mozile? tu je zdroj ...
z nahratych obr od uzivatela(2000*1600 napr) spravim obr mensi(640*480) a potom aj nahlad este..
tie if zistuju ake rozmery ma mat nahlad... maly obrazok...

<html><body>
<form action="?" METHOD=post ENCTYPE="multipart/form-data">



<input class='button'name="upload" type=submit value="Posla»">

<input type="file" name="browse"> <font face="arial"size="2">Nepovinné!</font>


</form>


<?php
header('Content-type: image/jpeg');
if ($_POST["upload"] == "Posla»")
{

$soubor = $_FILES['browse']['tmp_name'];
$soubor_name = $_FILES['browse']['name'];
list($jmeno,$typ) = explode(".",$soubor_name);

if($upload!="")
{$w=0;$typ = strtolower($typ);}
if($upload=="")
$w=1;

if (($typ == "jpg") || ($w==1))
{
$name="buf.jpg";
move_uploaded_file($soubor,$name);
$rozmery = getimagesize("$name");
$type = $rozmery['mime'];
$width = $rozmery[0];
$height = $rozmery[1];
$pomer=($width/$height);
if ( ($width>640) || ($height>640) )
{
if($pomer>1)
{$widthx=640;$heightx=(640/$pomer);$widthy=100;$heighty=(100/$pome r);}
if($pomer<1)
{$widthx=(640*$pomer);$heightx=640;$widthy=(100*$pomer);$heighty=1 00;}
if($pomer==1)
{$widthx=640;$heightx=640;$widthy=100;$heighty=100;}
if($pomer>2)
{$widthx=640;$heightx=640/$pomer;$widthy=(100*$pomer);$heighty=100 ;}
}
if( (($width<=640) && ($height<640)) || (($width<640) && ($height<=640)) )
{
if($pomer>1)
{$widthx=$width;$heightx=$height;$widthy=100;$heighty=(100/$pomer) ;}
if($pomer<1)
{$widthx=$width;$heightx=$height;$widthy=(100*$pomer);$heighty=100 ;}
if($pomer==1)
{$widthx=$width;$heightx=$height;$widthy=100;$heighty=100;}
}


$pocitadlo=file_get_contents('pocitadlo');
$pocitadlo=str_replace("\r\n","",$pocitadlo);

$meno="foto/".$pocitadlo.".jpg";
$thumb = imagecreatetruecolor($widthx, $heightx);
$source = imagecreatefromjpeg($name);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $widthx, $heightx, $width, $height);
imagejpeg($thumb,"$meno",100);

$meno="foto/".$pocitadlo."x.jpg";
$thumb = imagecreatetruecolor($widthy, $heighty);
$source = imagecreatefromjpeg($name);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $widthy, $heighty, $width, $height);
imagejpeg($thumb,"$meno",100);

$pocitadlo++;
$subor=fopen('pocitadlo',w);
fputs($subor,$pocitadlo);
fclose($subor);
}
}
?>

</body></html>
Toto téma je uzamčeno. Odpověď nelze zaslat.

0