| | | | |
| | |
| Gast
Beiträge: n/a
| Hallo! Um Bilder aus einem Ordner auf meiner Webseite anzeigen zu lassen benutze ich folgenden Programmcode: ...s.u. Jetzt möchte ich noch, dass ein Bild welches mit $_width_max_ = 500 auf meinen Seite angezeigt wird, zusätzlich mit einem Link oder so in seiner vollen Größen (also $_width_max_ = 0) auf einen neuen leeren Seite angezeigt wird. Da ich nicht so erfahren bin, gelingt es mir nicht. Ich hoffe, dass mir einer weiterhelfen kann. :wink: Gruß, Frank --------------------------------- config.php: ------------- <? // image directory $_images_dir_ = './'; // min width of image $_width_min_ = 100 ; // odstep od zdjecia w poziomie $_vspace_ = 20 ; // odstep od zdjecia w pionie $_hspace_ = 20 ; // border of image $_border_ = 0; // sorting // SORT_ASC, SORT_DESC $_sort_ = SORT_ASC; // width of full image // if original width, set this variable to 0 $_width_max_ = 500 ; // show filename below image // 1 = YES, 0 = NO $_filename_ = 1; // number of cols $_no_cols_ = 3; // number of images on the site ( = number rows x number cols) $_no_pics_per_page_ = 12; ?> index.php: -------------- <? if(is_file('../config.cfg.php')) require '../config.cfg.php'; else die('Error, no config file'); if(!is_dir($_images_dir_)) die('Error, no image directory'); ?> <?php $location = "../../../"; $title = "Konzerte"; $title_1 = "Photos"; $document = "Zita Swoon"; $link = "concerts.php"; $link_1 = "concerts_2.php"; require ($location."head.inc"); require ($location."content.inc"); require ($location."config.php"); ?> <? $time_start = microtime(true); $noimage = 0; if ($dh = opendir($_images_dir_)) { while (($f = readdir($dh)) !== false) { if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'jpg')) { $imageinfo = getimagesize($_images_dir_.$f); $width = $imageinfo[0]; $height = $imageinfo[1]; $size = round(filesize($_images_dir_.$f)/1024,1).' KB'; $noimage++; $images[] = array('filename' => $f, 'width' => $width, 'height' => $height, 'size' => $size); array_multisort($images, $_sort_, SORT_REGULAR); } } closedir($dh); } if($noimage) { if($_GET["img"] != '') { echo '<p class="name">'.$images[$_GET["img"]][filename].'</p>'; if($images[$_GET["img"]][filename] != '') { if($_GET["img"]) $_no_ = ceil(($_GET["img"]+1)/$_no_pics_per_page_); else $_no_ = 1; if($_GET["img"] == 0) $side = '<p class="link">upnext >></p>'; elseif($_GET["img"] == ($noimage-1)) $side = '<p class="link"><< prevup</p>'; else $side = '<p class="link"><< prevupnext >></p>'; echo $side.'<p align="center">[img]picture.php?img='.$images[$_GET[[/img]</p>'.$side; } } else { // echo $noimage.' '.print_r($images); if($noimage > $_no_pics_per_page_) $norows = ceil($_no_pics_per_page_/$_no_cols_); else $norows = ceil($noimage/$_no_cols_); $nopos = ceil($noimage/$_no_pics_per_page_); // echo $nopos; echo '<table border="0" align="center" cellpadding="0" cellspacing="0"> '; if($_GET["no"] == "") $no = 1; else $no = $_GET["no"]; $index=abs($no-1)*$_no_pics_per_page_; if(($noimage-$index)<$_no_pics_per_page_) $norows= ceil(($noimage-$index)/$_no_cols_); for($a = 1;$a<=$norows;$a++) { echo ' <tr> '; for($b = 1;$b<=$_no_cols_;$b++) { if($images[$index][filename] != '') { echo '<td width="'.(2*$_vspace_+$_width_min_).'" valign="top" align="center">[img]picture.php?img='.$images[$index][filename].'[/img] '; if($_filename_) echo '<span class="name">'.$images[$index][filename].'</span> '; echo '</td>'; $index++; } else echo '<td width="'.(2*$_vspace_+$_width_min_).'"></td>'; } echo '</tr> '; } echo ' </table> '; if($nopos>1) { echo '<p class="link">'; for($i=1;$i<=$nopos;$i++) { if($i == $no) echo '<font>'.$i.'</font>'; else echo ''.$i.''; } echo '</p>'; } } } else die('No images in directory'); $time_end = microtime(true); $time = $time_end - $time_start; require ($location."content_end.inc"); require ($location."foot.inc"); ?> und.... pictue.php: ----------------------- <? if(is_file('../config.cfg.php')) require '../config.cfg.php'; else die('Error, no config file'); if($_GET[img] == "") exit; if (!ereg('^[^./][^/]*$', $_GET[img])) exit; $_image_ = $_images_dir_.$_GET[img]; $new_w = $_width_min_; $imagedata = getimagesize($_image_); // echo $_image_; if(!$imagedata[0]) exit(); $new_h = (int)($imagedata[1]*($new_w/$imagedata[0])); if($_GET["show"] == "full") { if($_width_max_) { if($imagedata[0]<$_width_max_) { $new_w = $imagedata[0]; $new_h = $imagedata[1]; } else { $new_w = $_width_max_; $new_h = (int)($imagedata[1]*($new_w/$imagedata[0])); } } else { $new_w = $imagedata[0]; $new_h = $imagedata[1]; } } if(strtolower(substr($_GET[img],-3)) == "jpg") { header("Content-type: image/jpg"); $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFromJpeg($_image_); $dst_img = imagecreatetruecolor($new_w, $new_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_ w,$new_h,ImageSX($src_img),ImageSY($src_img)); $img = Imagejpeg($dst_img); } if(substr($_GET[img],-3) == "gif") { header("Content-type: image/gif"); $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFromGif($_image_); ImagePaletteCopy($dst_img,$src_img); ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w, $new_h,ImageSX($src_img),ImageSY($src_img)); $img = Imagegif($dst_img); } ?> |
| | |
| PHP Code Flüsterer Registriert seit: 21.08.2005 Beiträge: 4682 PHP-Kenntnisse: Fortgeschritten | |
| Themen-Optionen | |
| Thema bewerten | |
|
|
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Suche dynamische Gallerie | jlsksr | Scriptbörse | 4 | 21.06.2008 01:01 |
| Gallerie includen | kinglui | PHP Tipps 2006 | 8 | 17.09.2006 22:19 |
| CSS Gallerie funktioniert nicht im IE (vllt z-index??? ) | HTML, Usability und Barrierefreiheit | 1 | 25.07.2006 22:04 | |
| Ich brauch Hilfe für eine Gallerie!!! | PHP Tipps 2006 | 10 | 20.02.2006 16:56 | |
| Umfrage und Gallerie | Newsscript | PHP Tipps 2005-2 | 8 | 31.12.2005 11:14 |
| GAllerie Problem | PHP-Fortgeschrittene | 5 | 16.09.2005 02:00 | |
| Flash Gallerie | 'progman' | Beitragsarchiv | 9 | 19.08.2005 17:11 |
| [Erledigt] Blätterfunktion bei meine Gallerie | PHP-Fortgeschrittene | 5 | 04.03.2005 15:19 | |
| gallerie skript - extra wünsche | Beitragsarchiv | 4 | 30.12.2004 14:16 | |
| gallerie mit php | PHP Tipps 2004-2 | 2 | 06.11.2004 18:57 | |
| Gallerie | Off-Topic Diskussionen | 2 | 13.08.2004 18:24 | |
| und nochmal gallerie... | Sclot | PHP Tipps 2004 | 6 | 15.07.2004 20:07 |
| totaler anfänger.....kleine bilder gallerie, aber... | PHP Tipps 2004 | 7 | 06.07.2004 09:30 | |
| counter für gallerie | Sclot | PHP Tipps 2004 | 2 | 05.07.2004 15:36 |

Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.