Image display

I tried the search but it came up empty. I am looking for a ultra simple php script that I can drop into an image folder and have the images displayed and then rewind and start again.
I am setting up a art website for the local art society I joined. I found a nice classified script that uses SQL and works a dream. I am trying to achieve a starting page that will display images one by one. The only script that comes close only displays gif files so I am still looking.

My php is very basic and trying the myriad of scripts out there I have not found one yet. It would have to handle any image type.

I have been able to get an image from a folder and display it in php but now to select the next file and re display that is my task. I believe that I will get it working myself but I still would like help.

That depends what you mean when you say you want the images displayed one by one.

Do you mean you want this done on the client computer or via a php script on the server when the client clicks a link on the web page?

Nice effects can be achieved when you’re using javascript but with php the page will have to update for every picture unless you’re using ajax.

The only script that comes close only displays gif files so I am still looking.

You could probably change that.

I would use something like this to populate a Jquery slide show.


<?php
// Directory to read images from
$dir = "customers/";

// Read the directory and sellect EVERYTHING
$filenames = glob( "$dir*" );

// Start the loop to display the images
foreach ( $filenames as $filename ) {

// Get the image size for use in the image call
$size = getimagesize( $filename );

// Display the images - OR USE TO CREATE THE LIST IN A SLIDESHOW.
echo "<img src=\\"".$filename."\\" ".$size[3]." />\
";
	}
	
?>

Thanks Rubble most helpful also for the link which I take is your site.

I dropped the code you gave into a www image directory and it certainly worked in php designer. Strangely it also worked in Wamp up to a point. In Wamp localhost the screen was filled with containers of the photos in PHP Designer the screen was filled with the images. they did not rotate though. the whole lot hit the screen. Maybe the page needs refreshing each time.

I will study the information on your site and the code to see what gives and what I can come up with. It certainly looks interesting

I do appreciate your advice and expect as usual I have it wrong or some setting is wrong.
Thanks again to both of you
Terry

Terry my example code will display all the images at once as is.

To get your slide show I would as I say use a Jquery slide show and where you need to put the list of images replace the list with this code then modify this line to be a list item rather than an image call:

echo "<img src=\\"".$filename."\\" ".$size[3]." />\
"; 

That is what I did for a friends website: GP Wheels - Motorcycle Touring

You could always modify this line and have all the images on one page then link to a larger image:

echo "<a href=\\"".$filename."\\"><img src=\\"".$filename."\\" ".$size[3]." /></a>\
"; 

Thanks for help. Your friends site is impressive. What I am after is that on the index welcome to the site page I will place a nice picture frame image and gradually cycle all the paintings that have been submitted inside that frame. I have the images in a folder both thumbs and resized larger images. I will use the thumbs initially and eventually add a link to display the larger image.

There is no time constraints and I have played with the code you gave me to understand how it works. I can create Windows applications but new to the syntax of php.

The link to Image Magic has opened Pandora’s box and I expect I shall spend many hours discovering its tricks. I am 68 retired and this is a hobby and when something works it is a pleasure. I also paint so I have a vested interest in this site I shall set up for our society. I have been instructed by very talented individuals and since October last year I have been prolific. For example I put some on Photobucket Pictures by inkmon - Photobucket

My main site is Universal Ink Monitor I created that for Canon users after making one for my HP. Pays for hosting charges

Terry

I will place a nice picture frame image and gradually cycle all the paintings that have been submitted inside that frame

This could take some time depending on how many pictures you have and so it might be good to have a way to jump to a certain area and allow people to fast forward through the slideshow.
As I say I think Jquery is the way to go for the slideshow; search google and find one you like. You need to upload the Jquery files and the slideshow which is not hard. With Jquery slideshows you need to give a list of images to use; if you use the code I supplied before you can automate this and everytime a new image is uploaded it is automaticaly added to the slideshow.

Imagemagick is a very useful piece of software and I use it on my server and in a batch file to resize images etc. on my PC.

It is strange that the code did not work in WAMP as I use XAMPP and it works OK.

It is strange that the code did not work in WAMP as I use XAMPP and it works OK.

You are right. The same code even made simpler works in phpdesigner but not using Localhost in Wamp. Strange but there must be a reason. Still when I find the reason I will learn. Up to now it has worked flawlessly in a classified site I created but no slide show. Life is like that some bug probably yours truely. I will re install Wamp 1st. I heard of XAMPP but was happy with Wamp.

Now JQuery that is another thing to investigate. I now have many paths to follow. Just when I thought it safe to get back in the water eh!.

I do appreciate your comments. One point, I was told by a bank teller the other day that “You oldies do not know about computers”. She forgot who invented them in the first place :rolleyes:

The beginning of the art site is:
Untitled Page I will use a subdomain till they get there own. Lot of prettying required yet. I am engaged in a SQL database creation application on the side, you would appreciate, it would have a Windows application that creates the files and ftp’s them to the server where a call to the installation php file would create the database, tables and fields. It is image manipulation that I am having difficulty. Plus, as I said I am only learning php. I will not mention my other interests, too much time on my hands I suppose.

Your site is most informative, I am glad I found it, I shall learn much from it.

Terry

found the problem it is reference to the image location
ie http://localhost/images needed
Late now more tomorrow
Terry

I find the older I get the harder it is to learn so you are doing well Terry.

You have a lot of sections on your site to keep you busy for a while.

I have just rebuilt my gallery to use a database; before it used the basic code I first posted: Anthony’s photo gallerys
The main reason I used a database this time was to store the photo EXIF data and so the photos could be used in more than one section.
I tend to rebuild the gallery every year or so using a different method.

I find the older I get the harder it is to learn so you are doing well Terry.

Learning is a right a lot of people relinquish. It is just a simple matter of opening ones mind to the fact that it is no weakness in admitting not knowing something. The more you know the less you brag.

I do like your photos. I was born in Hounslow, Middlesex, Emigrated to Australia at 21 in 1964. Now have a Aussie accent thanks to a Australian wife of 46 years. Sorry to say it was the weather not the country that prompted the move.

You have a lot of sections on your site to keep you busy for a while.
Yes I agree, I like to create pages like I paint. Quickly, put down a support base and then work on each element till they satisfy me. When I think about it I program the same way.

In a way you have committed me to a ton of work, to which I thank you.
I believe you to be one of the more interesting fellows of this world. You are an educator.

G’Day
Terry

Rubble I have a solution and the front page. I am using a simple random grab of the images and using a bit of html for the display and a meta refresh to update the image every 5 seconds. You certainly have given me a huge bite to chew and things will get more sophisticated as time goes on.
ImageMagic, Imagic and Jquery will hold my attention for many intriguing hours.

Thanks
Terry