php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2004

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 03.07.2004, 14:47  
Gast
 
Beiträge: n/a
Standard Link auf Externes Bild mit Größenanpassung

Ich habe eine Private Homepage mit Bildern. Die Seite auf der die Bilder stehen wurde in PHP geschrieben. Nun möchte ich folgendes machen. Klickt man auf ein Bild soll sich ein neues Fenster öffnen, in dem das Bild in der original Größe zu sehen ist. Das Fenster in dem das Bild ist, soll sich der Größe des Bildes automatisch anpassen. Ich weiß wie das vergleichbar mit Java-Script funkioniert. Dort ist es ja "javascript:var external=window.open('http://url', 'external', 'width=breite,height=höhe')" aber wie funktioniert das in PHP und mit automatischer Größenanpassung? Kann mir Jemand helfen????????
Danke schonmal im Voraus! - Anbei noch der Quellcode von meiner Bilder Datei:



<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">

a:link {
color: #00FF00;
text-decoration: none;
}
a:visited {
color: #00FF00;
text-decoration: none;
}
a:hover {
text-decoration: none;
color: #FFFFFF;
}
a:active {
color: #00FF00;
text-decoration: none;
}

.menue {
font-family: Arial;
font-size: 12px;
font-weight: normal;
color: #F98E1D;
text-decoration: none;
background-color: #000000;
}
.underline {
border-bottom-width: 2px;
border-bottom-style: solid;
border-bottom-color: #F98E1D;;
}
.copy {
font-family: Arial;
font-size: 10px;
font-weight: normal;
color: #F98E1D;
text-decoration: none;
}
.vorschaurahmen {
border: 2px solid #F98E1D;
text-align: center;

}
.kommentar {
font-family: Arial;
font-size: 14px;
font-weight: normal;
color: #F98E1D;
text-decoration: none;
text-align: center;
}

</style>
</head>
<body bgcolor="#000000">
<?php if(!is_file("include.php"))
{echo "<span class=\"menue\">Führen Sie <a href=\"setup.php\">setup.php</a> aus!</span>"; exit;}
require("include.php");?>
<table width="100%" height="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td>

</td>
<td width="60%" align="right" valign="bottom" nowrap class="underline"></td>

</tr>

<?php
$photo = $_GET[photo];
if(!empty($photo))
{
$photofile = "$photo".".jpg";
//Menue anzeigen
echo "<tr><td height=\"2\" colspan=\"2\"><a href=\"index.php\" class=\"menue\"> Photo schließen</a><a href=\"index.php#$photo\" class=\"menue\"> Zur&uuml;ck</a> </td></tr>";
//Photo anzeigen
$bilder = file($daten);
while (list ($line_num, $line) = @each($bilder))
{
$photos = explode("&&", $line);
if($photos[0]==$photo)
{
$comment = "$photos[1]";
}}
echo "<tr><td height=\"2\" width=\"40%\" class=\"underline\"><img src=\"$photofile\" border=\"0\" alt=\"$comment\">";
echo "
<span class=\"kommentar\">$comment</span>";
echo "</td><td width=\"60%\" class=\"underline\"></td></tr>";

}
?>
<tr>
<td></td>
</tr>
<tr valign="top">
<td colspan="2">
<?php

//Übersichtsbilder anzeigen
echo "<table width=\"10%\" border=\"0\" cellpadding=\"4\" cellspacing=\"2\"><tr>";
$bilder = file($daten);
if(empty($id)){$id="$bilder[0]";}
$anzahl = count($bilder);
$test = "$anzahl"/"$anzeige";
while(!is_integer($test))
{
$hinzu = "$anzahl"+"1";
$pad = "\n";
$bilder = array_pad($bilder,$hinzu,$pad);
$anzahl = count($bilder);
$test = "$anzahl"/"$anzeige";
}

while (list ($line_num, $line) = @each($bilder))
{
$teiler = "$line_num"/"$anzeige";
$photos = explode("&&", $line);
$image = "$photos[0]";
$image = chop($image);
$imagefile = "$photos[0].jpg";

$comment = $photos[1];
if(empty($image))
{
$c .= "<td></td>";
}
if(!empty($image) and is_integer($teiler) and $line_num != "0")
{
$thumbnail = "$url"."thumbnails/"."$imagefile";
$imageurl = "$url"."$imagefile";
$c .= "</tr><tr><td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$image.jpg\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}
if(!empty($image) and !is_integer($teiler) or $line_num == "0")
{
$imageurl = "$url"."$imagefile";
$thumbnail = "$url"."thumbnails/"."$imagefile";
$c .= "<td valign=\"top\" class=\"vorschaurahmen\">
<table width=\"100%\" height =\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"top\"><a name=\"$image\"></a><a href=\"$image.jpg\" target=\"_blank\"><img src=\"$thumbnail\" alt=\"$comment\" border=\"0\"></a></td>
</tr>
<tr>
<td valign=\"bottom\" class=\"vorschaurahmen\" height=\"100%\"><span class=\"kommentar\">$comment</span></td>
</tr>
</table>
</td>";
}
}
echo $c;
echo "</tr></table>";
?>
<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="4">
<tr>
<td height="100%"></td>
<td></td>
</tr>
</table>


</p></td>
</tr>
</table>

</body>
</html>
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 03.07.2004, 15:07  
Erfahrener Benutzer
 
Registriert seit: 21.05.2008
Beiträge: 2.150
Guradia befindet sich auf einem aufstrebenden Ast
Standard

Die einfache Antwort: Ist nicht!

PHP hat genausowenig, wie JS allein, Ahnung davon, wie gross das Bild ist.

PHP hätte zwar die Möglichkeit, das zu ermitteln, dazu muss es aber das Bild downloaden und analysieren. Das kannst du natürlich einmal machen lassen und die Infos lokal speichern.
Dies geht hiermit recht simpel:
http://de.php.net/manual/de/function.getimagesize.php
http://de.php.net/manual/de/function...t-contents.php (umd das Bild evtl. zu holen, weiss gerade nicht, ob getimagesize() das nicht selbst kann)
Guradia ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Bild als Link Mcxreflex PHP Tipps 2008 4 15.07.2008 14:28
Bild vor Link pattern TimmaY PHP Tipps 2007 5 21.03.2007 18:06
bild mit link ohne ziel wird immer markiert kiffy HTML, Usability und Barrierefreiheit 3 16.10.2006 12:34
infos auf link oder bild wenn die maus darauf zeigt? PHP Tipps 2006 11 04.02.2006 00:17
externes Bild in php ausgeben PHP Tipps 2005-2 3 30.08.2005 13:50
Suche Tipps für Persormance-Steigerung (Geld für Nützliches) Beitragsarchiv 18 16.08.2005 10:57
.gif bild als button mit hiterlegtem link PHP Tipps 2005-2 11 17.06.2005 20:57
Bild (.jpg) mit Link auf Festplatte speichern PsychoEagle PHP Tipps 2005-2 11 16.06.2005 14:54
Bild mit Link aus Tabelle nebeneinander ausgeben PHP Tipps 2005 3 25.04.2005 12:19
Zentriert + Bild mit Link PHP Tipps 2005 5 24.04.2005 16:35
Zentriert + Bild mit Link HTML, Usability und Barrierefreiheit 3 24.04.2005 04:02
über Bild gelegter Link nichtg anwählbar Stümper HTML, Usability und Barrierefreiheit 7 22.03.2005 19:54
externes Bild binär auslesen PHP Tipps 2005 35 10.02.2005 22:27
Aktuelle Seite = Link aus einer Datei => BILD? PHP Tipps 2004 2 07.09.2004 21:49
[Erledigt] bild als link HTML, Usability und Barrierefreiheit 3 07.06.2004 12:48

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
getimagesize externes bild, php externes bild getimagesize, externes bild mit php öffnen, php getimagesize externes bild, verlinkung auf ein externes bild, php bild link test, php bild als link grösse, vorschaurahmen in website in html, php externes bild darstellen, link foto größer, externes bild html, bild link größe, externes jpg anzeigen php, image link mit größe, php externes bild laden, css link auf ein externes bild, link auf externes bild

Alle Zeitangaben in WEZ +2. Es ist jetzt 05:13 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.