View Full Version : PHP aiutino
Manson666
10-11-2003, 22:58
Ho uno script che genera una galleria delle immagini e dovrei trovare il modo di far stampare sopra (o anche sotto) ogni immagine la directory nella quale è contenuto il file e il nome del file...come posso fare?
Manson666
10-11-2003, 23:09
lo script è questo, che ci posso fare?:
<?php
// 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>";
?>
intendi scrivere direttamente sull'immagine oppure nella pagina html normale ?
ciao ;)
Manson666
11-11-2003, 15:23
sotto l'immagine dove dice il nome del file vorrei inserirci anche il nome della directory in cui è contenuto il file della jpg
if ($show_filename==1)
{
echo "$picdir/$file"; // shows file name
}
Basta fare questa piccola modifica !!!
Manson666
11-11-2003, 21:00
Grazie,
te sei sempre il mio salvatore se mi dai una tua foto e le tue misure ti faccio una statua :-P
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.