You are here: Re: how to create a gallery without using the EXIF function? « PHP Programming Language « IT news, forums, messages
Re: how to create a gallery without using the EXIF function?

Posted by Geoff Berrow on 11/22/05 09:04

Message-ID: <i015o1d4ev501ijadrb4s5ptdg3d233j9m@4ax.com> from FayeC
contained the following:

>I need to create a code that will pull out 4 images from a folder that
>will have the same username as the user's login.
>After login the user is taken to a page that will contain the 4 images
>in the folder arranged in a table or div.


I started work on something similar last night.
http://www.ckdog.co.uk/jladder/files.php
It crudely shows .jpgs in a directory as thumbnails (simple browser
resizing). I've still got quite a bit to do, but it may be useful.


<HTML>
<HEAD>
<TITLE>File management</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">


<table align="center" border="1" cellspacing="0" cellpadding="2">
<?php

//$dir = $path."";
$path=$_SERVER['PATH_TRANSLATED'];
//print "$path<br>";
$i= strlen($path);
//print"$i<br>";
do{$i--;}
while(strpos($path,"/",$i)===false);
//print"$i<br>";
//print substr($path,0,$i);
$path=substr($path,0,$i+1);
$dir=$path;

// Open a known directory, and proceed to read its contents
//if (is_dir($dir)) {
$width=100;
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
//print $dir . $file;
if($file!="." && $file!=".." &&
strtolower(substr($file,-3))=="jpg"){

$size = getimagesize($file);

$height=($size[1]*$width)/$size[0];
echo "<tr><td><img src='$file'width='$width'
height='$height'></td><td><b> <a
href=\"$file\">$file</a></b></td></tr>\n";
}
}
closedir($dh);
}
//}
?>


</table>
</form>
</BODY>
</HTML>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация