...

View Full Version : Embed-able php photogallery that grabs a images in a dir.



pollardhimself
10-09-2012, 09:43 PM
I really like the look of Pagemap Imagewall (http://getpagemap.com/free-photo-gallery) However I don't have a lot of php experience, this has trouble with images, and I don't know how to embed it into my website.

I've been looking for a long time for something that can

Handle images over 5 mb
Easily Embedded into a existing .php page
Creates Thumbnails of images
Grabs all image from a directory folder




Trying to get it embedded into this page (http://vabrand.net/pictures.php)

nigel12
10-09-2012, 10:27 PM
Hi, I myself use the below code, what it does is this.
I allow people to upload images in to a directory,
All images in that directory get displayed on a webpage 1 at a time I have set a timer to 4 seconds.

So create a php file make sure it is empty then add the following code to it. You can see in the code below the php file is called getimages.php do not change any code in the file below you need to put this code in the same folder as your images.



<?
//PHP SCRIPT: getimages.php
Header("content-type: application/x-javascript");

//This function gets the file names of all images in the current directory
//and ouputs them as a JavaScript array
function returnimages($dirname=".") {
$pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)"; //valid image extensions
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){ //if this file is a valid image
//Output it as a JavaScript array element
echo 'galleryarray['.$curimage.']="'.$file .'";';
$curimage++;
}
}

closedir($handle);
}
return($files);
}

echo 'var galleryarray=new Array();'; //Define array in JavaScript
returnimages() //Output the array elements containing the image file names
?>

The next part is the code we need to place in the document where we want the images to display. I myself have created a table on the page where I want my images to display and put this code in to that. Now the code below you will need to change some info. So remember where I have used "pics" that is because the directory where my images are stored is called "pics" without the quotes. You would need to change that to the name of your directory.



<script src="pics/getimages.php"></script>

<script type="text/javascript">

var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", "pics/"+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}

window.onload=function(){
setInterval("rotateimages()", 4500)
}
</script>

<div style="width: 125px; height: 125px">
<img id="slideshow" src="pics/bear.gif" /></div>

If I have got the wrong idea about what you want take no notice of me :)
oh one last thing the very last line of code you see above looks like

<img id="slideshow" src="pics/bear.gif" /></div>

You will see I have specified the name of a particular gif image that is because my slide show will always start with that image :)

DrDOS
10-10-2012, 01:09 AM
What kind of image processing software is on the machine, it's usually GD
, which I'm not keen on because it uses fixed code, or Imagemagick, which is easier to code and more flexible, but requires shell access for most uses, you can use perl libraries though? That will determine how much of the code is written.

pollardhimself
10-10-2012, 09:24 PM
nigel12

I wasn't really looking for a slide show wanted more of a image gallery that creates thumbnails for all the images in a directory and displays them on my existing page.


And it doesn't seem to like anything over 5Mb either

Anyway to modify the Pagemap Imagewall to allow it to be embedded into my webpage and make it handle images over 5mb

pollardhimself
10-10-2012, 09:32 PM
What kind of image processing software is on the machine, it's usually GD
, which I'm not keen on because it uses fixed code, or Imagemagick, which is easier to code and more flexible, but requires shell access for most uses, you can use perl libraries though? That will determine how much of the code is written.

Its hosted at hostmonster.com

LJackson
10-10-2012, 10:44 PM
dunno if this is the sort of thing you are after
http://webcheatsheet.com/php/create_thumbnail_images.php

DrDOS
10-11-2012, 01:06 AM
Its hosted at hostmonster.com

It says photogaleries/coppermine

I don't see anything else. Coppermine is nice, might have something you can use.

pollardhimself
10-11-2012, 04:36 PM
It says photogaleries/coppermine

I don't see anything else. Coppermine is nice, might have something you can use.

Yeah they have some built in scripts, nothing that I liked

DrDOS
10-11-2012, 05:25 PM
Yeah they have some built in scripts, nothing that I liked
Do their scripts indicate that they are using GD or Imagemagick?
You may be able to use direct access.

pollardhimself
10-12-2012, 03:04 PM
Do their scripts indicate that they are using GD or Imagemagick?
You may be able to use direct access.

Looks like imagemagick is... what will this do for me?

https://my.hostmonster.com/cgi/help/imagemagick




http://nishantsoni.in/how-to-install-php-gd-library-on-cpanel-whm-server-with-centos.html/

DrDOS
10-12-2012, 06:55 PM
Looks like imagemagick is... what will this do for me?

https://my.hostmonster.com/cgi/help/imagemagick

http://nishantsoni.in/how-to-install-php-gd-library-on-cpanel-whm-server-with-centos.html/

I would go with Imagemagick since it is easier to code for. I see that they have convert, do they have any of the other applications, identify, mogrify, etc. ? Do you have shell access or do you have to use magickwand? I'm not familiar with it. Shell access is very easy, you just write a php script for it, it calls the BASH shell to run the script. You have a bit of learning to do, but you will be rewarded with a great deal of power over image processing. Imagemagick has a very good website.

pollardhimself
10-22-2012, 07:44 PM
Just wanted to share if anyone was looking for the same thing I found a awesome on that does more than I even wanted!

Handles large images
Embed-able
Will grab images out of a dir
Has admin panel with tons of options


KoschtIT Image Gallery (http://koschtit.tabere.net/)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum