A basic unlimited image gallery in just 20 lines of code

This is where you share YOUR scripts with others

Moderators: egami, macek, gesf

Post Reply
User avatar
New php-forum User
New php-forum User
Posts: 140
Joined: Sun May 11, 2008 1:40 am
Location: London, UK

Tue Jun 10, 2008 4:12 am

The same code but in 10 lines for the viewer.php and 2 lines for each index file.


Code: Select all

function gen_viewer( $img, $alt, $ver, $hor, $bor, $bgd, $ial, $rtn )
	echo "<html><head><style type='text/css'>body { background-image: url(" . $bgd . "); background-repeat: repeat; }</style></head><body><div align='" . $ial ."'>"<img class='main' src=" . $img . " width=" . $hor ." height=" .$ver ." border=" . $bor . " alt='" . $alt ."'><p>";
	if ( $rtn == 1 ) {
		echo "<FORM><INPUT type='button' onclick='history.back();' name='ReturnButton' value='Return'></FORM>";
	echo "</div></body>";
index file:

Code: Select all

require( "viewer.php" );
gen_viewer( "animage.jpg", "This is a title", 500, 500, 10, "abackground.jpg", "center", 0 );
I don't understand your maths actually.

If you are doing it with php rendered static pages you still need one file per image + 1 more for the viewer + 1 more for the picture listings.

so 100 images =

100 files for the images
100 index files
1 viewer function file
1 main index
Total 202 files for 100 images (including image files themself).

This could be done in 101 files (1 containing php code + 100 image files) by using a mysql database.

When posting code to be reviewed please enclose it in the [ code ] [ /code ] tags as it makes it a lot easier for people to read as it correctly formats itself on screen.

    Click Here to Visit[/url]

    New php-forum User
    New php-forum User
    Posts: 14
    Joined: Thu Sep 23, 2010 12:11 pm

    Thu Sep 23, 2010 9:17 pm

    Hi, you have shared really useful information with us. It has lots of worth for those people who want to start web hosting business. I'm running my own online business successfully with help of guruscript.com; it provides me scripts to make easier to my business. I'm very thankful to guruscript.comthat caters such kind of great services. Guruscript is also a great resource for those guys who are wondering to start their online business. I hope my info will help to many beginners in online world.


    online business idea

    New php-forum User
    New php-forum User
    Posts: 10
    Joined: Tue Jan 11, 2011 12:12 am

    Tue Jan 11, 2011 12:38 am

    the artificial egg
    Called the artificial eggs, entirely by chemical synthesis, in appearance not much different with the real eggs, real ones can really easily. The artificial eggs is simply a hoax, but the artificial tiffany charm bracelet, but there are still a special training course, is this how about ah? According to related news, to defraud the company to teach tiffany silver earrings in the name of the artificial eggs, charge high the amount of training fees.

    New php-forum User
    New php-forum User
    Posts: 76
    Joined: Sun Nov 28, 2010 6:33 pm

    Mon Jan 24, 2011 5:10 pm

    Thank you for your sharing!
    Glad to share with some php image gallery scripts.
    Best regards!

    Post Reply