You are here: Re: [PHP] JPG Slide show « PHP « IT news, forums, messages
Re: [PHP] JPG Slide show

Posted by "Richard Lynch" on 10/25/05 06:14

On Mon, October 24, 2005 9:58 pm, John Taylor-Johnston wrote:
> I remember trying this. It required GD version 2 or higher, not
> mentioned on their requirements page. Most of these galleries do. I'm
> waiting to get my sysadmin to install GD 2.x +. I have 1.6.x and only
> PHP Version 4.1.2
> It also requires changing disable_functions in the php.ini file, which
> luckily I can do. But not always for everyone.

Woof.

Okay, restricting oneself solely to GD 1.x (gak) and PHP 4.1.2 does
change the ground rules quit a bit...

Honestly, your BEST bet is getting current GD and using one of the
pre-existing galleries.

That said, the two requirements you gave initially:
slide show
thumbnails

are both completely do-able in GD 1.x

SLIDE-SHOW:
<?php
//Change the next 2 lines for sure:
$path = "/full/path/to/your/photo/directory/here";
$url_path = "/just/from/homepage/to/your/photo/directory/here";

$dir = opendir($path) or die("Could not opendir $path");
if (!isset($_REQUEST['file'])){
readdir($dir); //skip dir commonly known as "."
readdir($dir); //skip the ".." also
$file = readdir($dir); //should be a real image
}
else{
while (readdir($dir) != $file){
//do nothing, just skipping merrily along to find the file
}
//Okay, that was the image they just saw. Show the NEXT one:
$file = readdir($dir);
if ($file === false){
//They have seen the whole show... Start over? What?
//You get to code this part yourself.
}
}
?>
<html>
<head>
<title><?php echo htmlentities($file);?></title>
<meta http-equiv="refresh" content="1;<?php echo
$_SERVER['PHP_SELF'], "?file=", htmlentities(urlencode($file))?>"
/>
</head>
<body bgcolor="#ffffff"><table width="100%" height="100%"><tr><td
align="center">
<img src="<?php echo "$url_path/$file"?>" /></body>
</td></tr></body>
</html>


For making thumbnail, see http://php.net/imagecopyresized

That was in GD 1.x

The cooler, better, much nicer-looking imagecopyresampled came in 2.x,
I think.

There's a BUNCH of notes and examples there for this bit, so I'm not
typing another one.

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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