| Autor | Zpráva | ||
|---|---|---|---|
| Brmboš Profil * |
#1 · Zasláno: 5. 11. 2009, 14:03:56
Prosím o radu. Jsem už trochu zoufalý, protože tenhle problém převracím ze všech stran a nevím jak na něj.
Je možné, že jsem něco přehlédl, ale už opravdu asi nevidím co. Skript kterým odesílám: <? echo '<form name="formular1" action="odkazy1.php" method="post"> Pořadí: <br> <input type="text" name="poradi" size="2" maxlength="2"><br> <br> Alt: <br> <input type="text" name="alternative" size="25" maxlength="35"><br> <br> Adresa: <br> <input type="text" name="adresa" size="25" maxlength="35"><br> <br> Ikona: <br> <input type="file" name="image" size="40" alt="fotka"><br> <br> Text: <br> <textarea name="text" cols="70" rows="5"></textarea><br> <input type="hidden" name="akce" value="pridat"> <input type="submit" value="odeslat" class="tlacitko1"> </form>'; ?> Skript kterým zapisuju:
<?php
session_start();
session_register("ulozeno");
if (!$poradi || !$adresa || !$image || !$text)
{
$ulozeno = 1;
header ("Location: odkazy.php");
}
else
{
include("spojeni1.inc");
if ($image)
{
$soubor_name = ($_FILES["image"]["name"]);
$max_width = '100';
$max_height = '500';
$image = ($_FILES["image"]["name"]);
$size=GetImageSize($image);
$width=$size[0];
$height=$size[1];
}
if ($width)
$x_ratio=$max_width/$width;
if ($height)
$y_ratio=$max_height/$height;
if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
switch ($size[2]) {
case 1: $src=imagecreatefromgif($image); break;
case 2: $src=imagecreatefromjpeg($image); break;
case 3: $src=imagecreatefrompng($image); break;
}
$dst=ImageCreateTrueColor($tn_width,$tn_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0,$tn_width,$tn_height,$width,$height);
switch ($size[2]) {
case 1: ImageGif($dst,$cil.'/'.$image_name,100); break;
case 2: ImageJpeg($dst,$cil.'/'.$image_name,100); break;
case 3: ImagePng($dst,$cil.'/'.$image_name); break;
}
@ImageDestroy($src);
@ImageDestroy($dst);
$update = mysql_query("INSERT INTO odkazy (poradi, alt, adresa, obrazek, text) VALUES ('$poradi', '$alternative', '$adresa', '$soubor_name', '$text') ");
mysql_close();
$ulozeno = 2;
header ("Location: odkazy.php");
}
?>
No a chybu kterou mi to hlásí: Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 53 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 54 Warning: Cannot modify header information - headers already sent by (output started at /home/www/mz-fans.cz/www/admin/odkazy1.php:53) in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 68 Ještě doplním, že adresář má CHMOD 777 - takže v zápisu to nebrání. A do tabulky se zapíše všechno kromě $image_name Ještě jednou prosím o pomoc, a předem děkuju za postrčení správným směrem. Přidat mezi oblíbené |
||
| Kajman_ Profil * |
#2 · Zasláno: 5. 11. 2009, 14:27:57
Zkuste si vypsat $tn_width a $tn_height.
|
||
| Kajman_ Profil * |
#3 · Zasláno: 5. 11. 2009, 14:30:05
Třeba chybí je
<form enctype="multipart/form-data" ... |
||
| Brmboš Profil * |
#4 · Zasláno: 5. 11. 2009, 14:42:54
Doplnil jsem:
<form name="formular" action="odkazy1.php" method="post" enctype="multipart/form-data" onSubmit="return odkazy.php()"> a do zapisovacího skript jsem dal: $size=GetImageSize($image); $width=$size[0]; $height=$size[1]; } echo 'w: '.$width.'<br>'; echo 'h: '.$height; $max_width = '100'; a
switch ($size[2]) {
case 1: $src=imagecreatefromgif($image); break;
case 2: $src=imagecreatefromjpeg($image); break;
case 3: $src=imagecreatefrompng($image); break;
}
echo 'w: '.$tn_width.'<br>';
echo 'h: '.$tn_height;
$dst=ImageCreateTrueColor($tn_width,$tn_height);
No a hlásí to: Warning: getimagesize(Moskva0_little.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 20 w: h: w: h: Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 59 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/www/mz-fans.cz/www/admin/odkazy1.php on line 60 Už jsem doufal, že to bude takhle jednoduché |
||
|
Časová prodleva: 17 let
|
|||
0