|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Bannato
Iscritto dal: Oct 2000
Messaggi: 552
|
PHP problema con uno script di galleria immagini scaricato
Ho scaricato questo script che crea una galleria delle immagini ma quando lo vado ad aprire mi da i seguenti messaggi di errore:
1) Warning: Division by zero in c:\programmi\easyphp\www\img\bpa\bpa.php on line 50 x Thumbs.db 2) Warning: Division by zero in c:\programmi\easyphp\www\img\bpa\bpa.php on line 50 x galleriab1.0.php Può dipendere dal fatto che lo sto facendo girare in locale con Apache su WinXP e ci sono i Thumbsnails? <?php // BASIC PICTURE ALBUM // by Cory S.N. LaViska // // Questions or comments can be sent to aksival@laviska.com // or you can visit my personal website at www.laviska.com // // - This script takes a directory full of images and displays them as thumbnails on the screen // - Each thumbnail has a hyperlink to it's respective image (opens in a new window) // - The only major drawback is that the browser loads the full size image into memory and then scales it down, // which can be pretty slow on dial-up connections, depending upon image size and the server. // - The image directory should not contain ANY FILES OTHER THAN JPG, GIF, PNG, or other browser compatible images!!! // // * Note * This is not a full-featured, fancy image gallery. With a little programming effort, however, it // can become a very flexible photo album. This script is intended for those who wish to experiment // with PHP and it's capabilities and for anyone who wants a backbone to work off of. Tested on PHP 4. // // Please see Readme.htm for more information. // // // USER CONFIGURATION $picdir = "C:\Programmi\EasyPHP\www\img\friedrich"; // Directory the pictures are in (make sure you leave this as a relative path) $tablecolumns = 4; // Number of pictures to display horizontally $show_size=1; // Show image size? (1=yes, 0=no) $show_filename=1; // Show file name? (1=yes, 0=no) $thumb_width = 60; // Thumbnail width in pixels (height determined by W:H ratio of each image) $font = "verdana"; // Font name $fontsize = 1; // Font size $fontcolor = "#000080"; // Font color (hex or text-name format) $fontattribs="<B>"; // Additional font attributes as they would appear in regular HTML (i.e. <B><I><U>) // END OF USER CONFIGURATION! $column_width = 100 / $tablecolumns; // Figures out percentage of screen each column should take up $rowcount = 0; echo "<center>"; echo "<table border='0' cellpadding='5' cellspacing='5' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'>"; echo "<tr>"; if ($handle = opendir($picdir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<td align='center' width=$column_width%>"; echo "<font face='$font' size='$fontsize' color='$fontcolor'>"; echo "$fontattribs"; $size = getimagesize ("$picdir/$file"); $image_ratio = $size[1] / $size[0]; $thumb_height = $thumb_width * $image_ratio; echo "<a href='$picdir/$file' target='_blank'>"; echo "<img border=0 src ='$picdir/$file' width='$thumb_width' height='$thumb_height'><br>"; if ($show_size==1) { echo "$size[0] x $size[1]<br>"; // shows picture dimensions } if ($show_filename==1) { echo "$file"; // shows file name } echo "</a>"; echo "</td>"; $rowcount++; if ($rowcount >= $tablecolumns) { echo "</tr>"; echo "<tr>"; $rowcount=0; } } } closedir($handle); } // Close out the table echo "</tr>"; echo "</table>"; echo "</center>"; echo "</font>"; ?> |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Nov 2002
Città: Cosenza --> Roma
Messaggi: 853
|
controlla il percorso della cartella e la presenza di foto (ci devono essere solo foto!!);
__________________
GNU MyServer Wants YOU!! We live thinking we will never die. We die thinking we had never lived. Jason Becker |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 07:24.