Witam
Mam problem z resize zdjęć. Po przednio skrypt miałem na innym hostingu i działał. Zmieniejąc na nowy nie działa. Proszę was o pomoc co może być powodem.
Pozdrawiam
Poniżej podaję kod.
<body style="display:inline;background:none;"> <?php function resize($oimg,$name) { $twidth=640; $theight=480; $currwidth = imagesx($oimg); $currheight = imagesy($oimg); if ($currheight > $currwidth) { $zoom = $theight / $currheight; $newheight = $theight; $newwidth = $currwidth * $zoom; } else { $zoom = $twidth / $currwidth; $newwidth = $twidth; $newheight = $currheight * $zoom; } $nimg = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($nimg, $oimg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); imagejpeg($nimg,"../tmp/".$name.".jpg"); imagedestroy($nimg); // Destroying The Temporary Image imagedestroy($oimg); // Destroying The Other Temporary Image } $img1=$_FILES['im1'][name]; $foto[0]=$_POST['foto0']; $foto[1]=$_POST['foto1']; $foto[2]=$_POST['foto2']; $defimg=$_POST['defaultimg']; $ogl_id=$_POST['oglid']; $error=""; $a=0; while($foto[$a]!=''&&$a<3) { $a++; } { switch ($_FILES['im1']['type']) { case ($_FILES['im1']['type']=="image/jpeg")||($_FILES['im1']['type']=="image/jpeg"): $oimg = imagecreatefromjpeg("..tmp/".$ogl_id."_".$a.".jpg"); // Make A New Temporary Image To Create resize($oimg,$ogl_id."_".$a); break; case "image/gif": $oimg = imagecreatefromgif("../tmp/".$ogl_id."_".$a.".gif"); // Make A New Temporary Image To Create resize($oimg,$ogl_id."_".$a); break; case "image/png": $oimg = imagecreatefrompng("../tmp/".$ogl_id."_".$a.".png"); // Make A New Temporary Image To Create resize($oimg,$ogl_id."_".$a); break; default: $error="Plik ma niewła?ciwy format"; $img1=""; } } //header('content-type: text/html; charset=iso-8859-2'); ?> <script type="text/javascript"> function fileselected(file) { var fs=0; if (navigator.appName=='Microsoft Internet Explorer') { fs = 0; } else fs=file.files.item(0).fileSize; if (fs>1536000) { alert("Plik większy niż 1,5 MB. Spróbuj przeskalować zdjęcie do mniejszej rozdzielczo?ci, zwiększyć kompresję lub zapisać plik w innym formacie."); file.value=""; return; } document.getElementById('load').style.visibility='visible'; document.images.submit(); } </script> <font style="font-family:Tahoma;font-size:12px;font-weight:bold;color: rgb(51,102,204);"><br>Wybierz zdjęcia: (maksymalna ilo?ć 3 szt.)</br></font><br> <font style="font-family:Tahoma;font-size:10px;font-weight:normal;color: rgb(51,102,204);">Maksymalny rozmiar pliku to 1,5 MB. Akceptowane formaty zdjęć: JPEG, GIF, PNG.<br>Po załadowaniu zdjęć wybierz, które zdjęcie będzie wy?wietlane jako miniatura.<br></font> <font style="font-family:Tahoma;font-size:10px;font-weight:normal;color:red;"><?php echo $error;$error='';?></font><br> <form name="images" action="zdjecia.php" target="foto" method="post" enctype="multipart/form-data"> <input id="im1" name="im1" type="file" onchange="fileselected(this);"></input> <br> <br> <font style="font-family:Arial;font-size:12px;font-weight:normal;color: rgb(51,102,204);">Miniatura:</font> <br> <?php $ilfotek=3; $a=0; while($foto[$a]!=''&&$a<$ilfotek) { $a++; } if ($a<$ilfotek&&$img1!='') { echo '<input type="hidden" id="foto'.($a).'" name="foto'.$a.'" value="'.$ogl_id.'_'.$a.".jpg".'"></input>'; $foto[$a]=$a.".jpg"; $a++; } for ($a;$a<$ilfotek;$a++) { } $a=0; $sel=''; while($foto[$a]!=''&&$a<$ilfotek) { if ($a==$defimg) $sel='checked'; echo '<input type="radio" name="defaultimg" value="'.$a.'" '.$sel.' onclick="top.document.getElementById(\'defzdj\').value=this.value;"></input>'; if ($sel=='checked') $sel=''; echo '<img id ="img'.$a.'" src="../tmp/'.$ogl_id.'_'.$a.'.jpg" height="100" style="visibility:visible;border:none;cursor:pointer;" onclick="top.Slimbox.open(this.src);"></img>'; $a++; } if ($a<$ilfotek) { echo '<div id ="load" style="width:170px;height:40px;display:inline-block;font-family:Arial;font-size:10px;visibility:hidden;"><center>'; } // if ($a==$ilfotek) echo '<script type="text/javascript">document.getElementById("im1").disabled=true;</script>'; ?> <script type="text/javascript"> for(a=0;a<3;a++) { if (document.getElementById("foto"+a).value=="") break; } top.document.getElementById("ilzdj").value=a; </script> </body>