Re: JPG Slide show

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux