Bildausgabe geht ned
Christopher
- php
1 wahsaga
Grüß euch!
Wieso geht die Ausgabe der Bilddatei nicht??
<?
include('seiten/config/mysql/news.php');
$tabelle ="news";
$dbverbindung = mysql_connect ($host, $user, $password);
$dbanfrage = "SELECT * FROM $tabelle ";
$result = mysql_db_query ($dbname, $dbanfrage, $dbverbindung);
$id = $_GET['id'] + 1;
while ($ausgabe = mysql_fetch_object($result))
{
?>
<?=$ausgabe->art; ?>
<b>Titel:</b><br>
<?=$ausgabe->titel; ?><br><br>
<?
include('seiten/config/mysql/news.php');
$tabelle ="news";
$dbverbindung = mysql_connect ($host, $user, $password);
$dbanfrage = "SELECT * FROM $tabelle ";
$result = mysql_db_query ($dbname, $dbanfrage, $dbverbindung);
$id = $_GET['id'] + 1;
while ($ausgabe = mysql_fetch_object($result))
{
?>
<?=$ausgabe->art; ?>
<b>Titel:</b><br>
<?=$ausgabe->titel; ?><br><br>
<br><br>
<?php
function thumb_popup($file, $save, $width, $height, $prop = TRUE) {
// Requires GD-Lib > 2.0
// Ist $prop=TRUE, so werden die Proportionen des Bildes
// auch im Thumbnail eingehalten
if(!function_exists("show_popup")) {
function show_popup($original, $thumb) {
$infos = @getimagesize($original);
$w = $infos[0] + 40;
$h = $infos[1] + 40;
$infos_th = @getimagesize($thumb);
$link = "<a href="javascript:void(0);" onclick="window.open('".$original."', 'window".md5(microtime())."', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=".$w.", height=".$h.", left = 20, top = 20');">";
$link .= "<img src="".$thumb."" border="0" ".$infos_th[3]."></a>\n";
return $link;
}
}
if(!file_exists($save) || @filemtime($thumb)< @filemtime($file)) {
@unlink($save);
$infos = @getimagesize($file);
if($prop) {
// Proportionen erhalten
$iWidth = $infos[0];
$iHeight = $infos[1];
$iRatioW = $width / $iWidth;
$iRatioH = $height / $iHeight;
if ($iRatioW < $iRatioH)
{
$iNewW = $iWidth * $iRatioW;
$iNewH = $iHeight * $iRatioW;
} else {
$iNewW = $iWidth * $iRatioH;
$iNewH = $iHeight * $iRatioH;
} // end if
} else {
// Strecken und Stauchen auf Größe
$iNewW = $width;
$iNewH = $height;
}
if($infos[2] == 2) {
// Bild ist vom Typ jpg
$imgA = imagecreatefromjpeg($file);
$imgB = imagecreatetruecolor($iNewW,$iNewH);
imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW,
$iNewH, $infos[0], $infos[1]);
imagejpeg($imgB, $save);
return show_popup($file, $save);
} elseif($infos[2] == 3) {
// Bild ist vom Typ png
$imgA = imagecreatefrompng($file);
$imgB = imagecreatetruecolor($iNewW, $iNewH);
imagecopyresampled($imgB, $imgA, 0, 0, 0, 0, $iNewW,
$iNewH, $infos[0], $infos[1]);
imagepng($imgB, $save);
return show_popup($file, $save);
} else {
return FALSE;
}
} else {
return show_popup($file, $save);
}
}
// Quelldatei
$from = "./seiten/pic_news/<?=$ausgabe->bild; ?>";
// Ziel 1+2
$to1 = "./seiten/pic_news/thumb/<?=$ausgabe->bild; ?>";
// Funktionsaufruf mit Einbehaltung der Proportionen
echo thumb_popup($from, $to1, 150, 150, TRUE);
?>
<b>Date:</b><br>
<?=$ausgabe->date1; ?>.<?=$ausgabe->date2; ?> <?=$ausgabe->date3; ?><br><br>
<b>Text:</b><br>
<?=$ausgabe->text; ?><br><br>
<?php
} mysql_close ($dbverbindung)
?>
<br><br>
<b>Date:</b><br>
<?=$ausgabe->date1; ?>.<?=$ausgabe->date2; ?> <?=$ausgabe->date3; ?><br><br>
<b>Text:</b><br>
<?=$ausgabe->text; ?><br><br>
<?php
} mysql_close ($dbverbindung)
?>
Folgende Fehlermeldung kommt:
Zitat:
News Titel:
Was ist mit du?
News Titel:
Was ist mit du?
Warning: Division by zero in /opt/lampp/htdocs/weber/ff-korneuburg/startseite.php on line 68
Warning: Division by zero in /opt/lampp/htdocs/weber/ff-korneuburg/startseite.php on line 69
Date:
32.32 2342
Text:
Wer ander'n eine Bratwurst brät, hat ein Bratwurstbratgerät. 122 Wer ander'n eine Bratwurst brät, hat ein Bratwurstbratgerät
News Titel:
Test123123
Fatal error: Cannot redeclare thumb_popup() (previously declared in /opt/lampp/htdocs/weber/ff-korneuburg/startseite.php:45) in /opt/lampp/htdocs/weber/ff-korneuburg/startseite.php on line 45
__________________
mFg christopher
hi,
Wieso geht die Ausgabe der Bilddatei nicht??
"geht nicht" gilt hier immer noch nicht als akzeptable fehlerbeschreibung.
und einfach den kompletten quellcode hier abzuladen, mit "kuckt ihr ma' ..."-unterton, genauso wenig.
Warning: Division by zero in /opt/lampp/htdocs/weber/ff-korneuburg/startseite.php on line 68
tja, durch null teilen geht nun mal nicht.
finde also raus, _warum_ dies an dieser stelle passiert - warum hat der divisor den wert null, mit dem du ja offenbar nicht gerechnet hast?
Fatal error: Cannot redeclare thumb_popup()
du kannst eine funktion natürlich nur einmal deklarieren.
du hast die deklaration aber innerhalb deiner schleife untergebracht - das ist natürlich unfug.
gruß,
wahsaga