Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Embed-able php photogallery that grabs a images in a dir.

    I really like the look of Pagemap Imagewall 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

  • #2
    New to the CF scene
    Join Date
    Oct 2012
    Location
    Birmingham
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 Code:
    <?
    //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.


    PHP Code:
    <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
    Last edited by nigel12; 10-09-2012 at 09:30 PM.

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,026
    Thanks
    15
    Thanked 240 Times in 240 Posts
    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.

  • #4
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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
    Last edited by pollardhimself; 10-10-2012 at 08:26 PM.

  • #5
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    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

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts
    dunno if this is the sort of thing you are after
    http://webcheatsheet.com/php/create_...ail_images.php

  • #7
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,026
    Thanks
    15
    Thanked 240 Times in 240 Posts
    Quote Originally Posted by pollardhimself View Post
    Its hosted at hostmonster.com
    It says photogaleries/coppermine

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

  • #8
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    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

  • #9
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,026
    Thanks
    15
    Thanked 240 Times in 240 Posts
    Quote Originally Posted by pollardhimself View Post
    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.

  • #10
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    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...h-centos.html/
    Last edited by pollardhimself; 10-12-2012 at 02:06 PM.

  • #11
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,026
    Thanks
    15
    Thanked 240 Times in 240 Posts
    Quote Originally Posted by pollardhimself View Post
    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.

  • #12
    New Coder
    Join Date
    Feb 2009
    Posts
    89
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •