Back Home

Open Designs

Community. Driven.

    • CommentAuthorwfiedler
    • CommentTimeMar 30th 2008 edited by wfiedler on the 01st April 2008 at 01:58:23 EDT
     
    Hi all,

    I'm just creating a little PHP image gallery.

    Demo here (Admin area)

    What I need is a function to delete the images (below the image link). I know there is a unlink function in PHP, but I have no idea how to use it with the script.

    The script

    Does anybody of you PHP gurus know how to do it?

    Thanks in advance!

    Wolfram
    •  
      CommentAuthorperthmetro
    • CommentTimeMar 30th 2008
     
    Looks good Wolfram... i'll chip in some beer money too for someone to help Wolfram
    •  
      CommentAuthorNickyD
    • CommentTimeMar 30th 2008
     
    Cool script Wolfram. I wish I could help as well.
    •  
      CommentAuthorbakercad
    • CommentTimeMar 31st 2008 edited by bakercad on the 31st March 2008 at 09:22:35 EDT
     
    Try this one Wolfram: Modified script

    ah....forget that, there's a conflict with the js. Should be fine now :)
    •  
      CommentAuthorNickyD
    • CommentTimeMar 31st 2008
     
    Bob is the php guru!
    • CommentAuthorwfiedler
    • CommentTimeMar 31st 2008
     
    Thanks Bob! I'll give it a try and will let you know.

    Many thanks again!

    Wolfram
    • CommentAuthorwfiedler
    • CommentTimeMar 31st 2008
     
    Uuuuuuuh works perfect Bob! Great!

    One little problem:

    In the gallery directory I have a php file, which reads the images in this folder: getpics.php

    This file is also shown in the list of the uploaded files. I don't want to show it. How can I exclude it?

    @Pete: This script will be part of my NanoCms pro version and I can also make a stand-alone version, if somebody wants it. I think, Bob needs some beer wink
    •  
      CommentAuthorbakercad
    • CommentTimeMar 31st 2008 edited by bakercad on the 31st March 2008 at 10:37:15 EDT
     
    Here's the solution....

    Find this line:
    $list_of_files[$file] = date("d-m H:i", filemtime($upload_dir.$file));

    And change it to this:
    $file_ext = strtolower(substr($file,strrpos($file,".")));
    if (in_array($file_ext, $FILE_EXTS)){
    $list_of_files[$file] = date("d-m H:i", filemtime($upload_dir.$file));
    }


    It checks the file extension from the $FILE_EXTS array & only displays those types of files. I've updated my file as well, if you just want to download it.
    •  
      CommentAuthorperthmetro
    • CommentTimeMar 31st 2008
     
    I'll take both the nanocms and the stand alone version thanks.

    For guys like you Wolfranm, i think you deserve this free given all the help you give out, but for leeches like me, i think i could/should donate to Bob via his website (paypal).

    great work guys

    Pete
    • CommentAuthorwfiedler
    • CommentTimeMar 31st 2008 edited by wfiedler on the 01st April 2008 at 02:41:30 EDT
     
    Yup! Works like a charm. What shall I say? Len already mentioned it: "You are the one and only php guru!" boogiecheerthumbupwhorship

    Demo (new version modified by Bob). Please don't upload crazy pics. Will be deleted soon.

    Edit:
    Please don't upload crazy pics

    I think Pete already did it...
    •  
      CommentAuthorbakercad
    • CommentTimeMar 31st 2008
     
    Lets not start rumors about me around here, but I appreciate your confidence in me bigsmile

    Glad to help you guys & I'd love to take you up on that beer cool

    bakie
    •  
      CommentAuthorbakercad
    • CommentTimeMar 31st 2008 edited by bakercad on the 31st March 2008 at 11:52:01 EDT
     
    Wolfram, if you're interested, I modified this a little bit so that when you click on "delete" you get a js alert box asking "Are you sure you want to delete this?"...just a safeguard against accidentally deleting an image.

    gallery-deleteconfirm.php.txt or try it here

    I fix some validation issues too bakie
    • CommentAuthorwfiedler
    • CommentTimeMar 31st 2008
     
    Thanks Bob. I also thought of an alert box. Great!

    I will tomorrow release the stand-alone version. I hope so, I'm very busy at the moment...
    •  
      CommentAuthorbakercad
    • CommentTimeMar 31st 2008 edited by bakercad on the 31st March 2008 at 12:11:39 EDT
     
    hehe...I noticed validation warnings because of the spaces in Pete's "long hair" pic. I changed the code again to automagically replace spaces with _ so the file name would be:

    1993_Peter_Long_Hair.jpg
    instead of
    1993 Peter Long Hair.jpg

    gallery.php.txt
    •  
      CommentAuthorperthmetro
    • CommentTimeMar 31st 2008
     
    My hair got in the way of everything back then too!
    •  
      CommentAuthorperthmetro
    • CommentTimeMar 31st 2008
     
    Posted By: wfiedlerPlease don't upload crazy pics. Will be deleted soon.

    Edit:
    Please don't upload crazy pics

    I think Pete already did it...


    Not as crazy as seeing an old man holding 2 beers! (you realise when you fall over you'll only spill twice as much Wolfram!)tongue
    •  
      CommentAuthorgnome
    • CommentTimeMar 31st 2008
     
    It looks great guys:
    1. The image loading lags badly for me (I am using the old 'PIII borg cube').
    2. The height should be fixed, because tall images push everything down an entire girdline (just like on OWD).
    • CommentAuthorwfiedler
    • CommentTimeApr 1st 2008
     
    Gallery PHP script ready for download:

    Download

    I made a slideshow and a gallery:

    Demos:

    Slideshow
    Gallery
    Upload

    For more instructions and changes read the PHP and JS files.

    If the upload doesn't work give writing permissions to the files and folders.

    The gallery and the slideshow work best with standard image dimensions, e.g 640x480 (biggest) scaled down to 500x375 for 1024x768 resolutions.

    Issues:

    The lightbox effect doesn't work with the gallery script. It uses a simple popup.

    2. The height should be fixed, because tall images push everything down an entire girdline (just like on OWD).

    Fixed!

    Have fun and many thanks Bob for your help!

    Wolfram
  1.  
    hot damn. That is something. Great work
    •  
      CommentAuthorNickyD
    • CommentTimeApr 1st 2008
     
    THANK YOU Wolfram for making it available for download.
    • CommentAuthorwfiedler
    • CommentTimeApr 1st 2008
     
    Not as crazy as seeing an old man holding 2 beers! (you realise when you fall over you'll only spill twice as much Wolfram!)

    Pete - it's not beer I'm holding. It's "Korea", a mixture of red wine and Coke which bikers in Germany like very much. It would kill an Aussiewink!
    •  
      CommentAuthorperthmetro
    • CommentTimeApr 1st 2008
     
    Thanks Wolfram, yet again you've done some really fantastic work.



    Red wine and coke! I'm gonna have to try that... It'd kill me though, I'm only an occasional mid-strength beer drinker nowadays. You should buy one of these... useful when you're drinking AND protects your head when you fall over, wet yourself and call a taxi!

    •  
      CommentAuthorbakercad
    • CommentTimeApr 1st 2008
     
    Wolfram....I fixed MOST of the validation errors. The only page I wasn't able to fix was the slideshow.php page. Is has 1 error because of the "name" attribute for the form. the slideshow.js file NEEDS the form to have the name="slideform". I don't know enough about js to fix that.

    Here you go: Download
    • CommentAuthorwfiedler
    • CommentTimeApr 1st 2008 edited by wfiedler on the 01st April 2008 at 10:19:02 EDT
     
    Thanks Bob! But as long as you operate with js you will have sometimes validation errors and no chance to get rid of them. As long as everything works...
    •  
      CommentAuthorperthmetro
    • CommentTimeApr 1st 2008
     
    And Thanks to Bob too... I'll send off the money for a 'Korea' or two

    now, if he can only do that snews mod request he said he would ages ago ;)
    •  
      CommentAuthorbakercad
    • CommentTimeApr 1st 2008
     
    @Pete tongue
    •  
      CommentAuthorgnome
    • CommentTimeApr 1st 2008
     
    About the JS, will it work if that name is changed to an ID? (I don't know much JS either)
    •  
      CommentAuthorbakercad
    • CommentTimeApr 1st 2008
     
    Posted By: gnomeAbout the JS, will it work if that name is changed to an ID? (I don't know much JS either)


    Nope....tried it bakie
    • CommentAuthorj4s0nn3w
    • CommentTimeJun 20th 2008
     
    Quick question.....

    Is there a way to have multiple galleries? So that when a visitor comes to the gallery page they can select a gallery like Christmas, Summer Vacation, or Birthday.

    Thanks for any input
    •  
      CommentAuthorgnome
    • CommentTimeJun 21st 2008
     
    I know that zenphoto does that, because that is how Pats photos are organized. Joes WPPA does it too. You could just run multiple versions (each in a differnet directory), but it would need to be edited to support that all by itself.
    • CommentAuthorJimBamir
    • CommentTimeJun 23rd 2008
     
    Nice idea here.

    Maybe we could have some kind of collaboration in adding some nice functions to this script?

    mail me via a.hodzic@g2n.eu
    •  
      CommentAuthorperthmetro
    • CommentTimeJun 23rd 2008
     
    i know of some similar free upload only(no image gallery) scripts that allow the admin to nominate the folder to upload to... just can't remember there names! I probably found them googling
    • CommentAuthorwfiedler
    • CommentTimeJun 23rd 2008
     
    Pete - I remember 'graystatic' did something similar... But 'graystatic' isn't around here for months.
    •  
      CommentAuthorperthmetro
    • CommentTimeJun 23rd 2008 edited by gnome on the 24th June 2008 at 17:12:22 EDT
     
    yeah i've got that image upload script of his
    I'll try to dig it out.. anyone want it or search this forum

    geez i'm good...
    http://graystatic.net/b/foto/fotoalbum.zip
    and
    http://graystatic.net/b/foto2/new/foto2.zip
    •  
      CommentAuthorgnome
    • CommentTimeJun 24th 2008
     
    Offtopic: pete: the HTML in your posts doesn't seem to work.
    •  
      CommentAuthorSean
    • CommentTimeJun 24th 2008
     
    @gnome: Pete is banned from OD for a few days, so he won't be able to answer your comment. When a user is banned, they can't log into the site or comment, they can only view things as a guest.
    •  
      CommentAuthorgnome
    • CommentTimeJun 25th 2008
     
    I saw that after my post. I see banned users don't get HTML in their already-posted comments.
    •  
      CommentAuthorSean
    • CommentTimeJun 25th 2008
     
    @pete: I noticed the HTML thing too, but Pete will be unbanned in a day or two so it should correct it's self soon enough.