Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 [2] 3 4 5

Author Topic: Simple PHP gallery  (Read 34960 times)

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #15 on: February 15, 2007, 12:24:45 PM »

Quote from: alpha10
Can I see a demo of this ?

Thanks
Currently I have this only in local network. You will have to setup and test it on Your own  :rolleyes:
« Last Edit: September 24, 2007, 12:17:56 PM by codetwist »
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1716
    • http://www.snewscms.com
Simple PHP gallery
« Reply #16 on: February 15, 2007, 02:25:38 PM »

I wouldn't use this script without the prior consent of the author or without examining the licence this was released under.
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #17 on: February 15, 2007, 04:13:48 PM »

Quote from: Luka
I wouldn't use this script without the prior consent of the author or without examining the licence this was released under.
FYI:

From source site:

Feel free to redistribute and reuse it under it's respective licence.

License is Creative Commons - Attribution-ShareAlike 2.5. It's more specific that sNews licence anyway, but still resuable and redistributable ;P

Only think missing is reference to it in css code, will add.

Any other problems with it, Luka?
« Last Edit: September 24, 2007, 12:20:41 PM by codetwist »
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #18 on: February 15, 2007, 04:27:10 PM »

Besides, what exactly means simply Creative Commons, Luka?
« Last Edit: September 24, 2007, 12:21:07 PM by codetwist »
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1716
    • http://www.snewscms.com
Simple PHP gallery
« Reply #19 on: February 15, 2007, 06:15:02 PM »

It was just my suggestion, nothing else.
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Simple PHP gallery
« Reply #20 on: February 15, 2007, 06:36:22 PM »

Creative Commons is the name of the organisation that is behind the different CC licenses, essentially a more relaxed form of copyright, though not really "copyleft" as some interpret it.

Find out more
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #21 on: February 15, 2007, 07:46:28 PM »

Quote from: agentsmith
Creative Commons is the name of the organisation that is behind the different CC licenses, essentially a more relaxed form of copyright, though not really "copyleft" as some interpret it.

Find out more
Thanks, but been there, seen it long time ago. Therefore I'm asking about license specifics, because simply creative commons doesn't make sense at all AFAIK. That's the reason why for example that CSS author has chosen something specific - attribution and share alike.
« Last Edit: September 24, 2007, 12:21:34 PM by codetwist »
Logged

ld3

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Simple PHP gallery
« Reply #22 on: February 16, 2007, 02:17:00 PM »

i can't get this working.  this is what i've done so far

1.  put gallery.php in my snews root directory
2.  put the css into a file called gallery.inc.css also in the root snews directory
3.  added a line to import the gallery.inc.css to my default css file
4.  added /usrimg directory to the snews root
5.  added /gallery directory to the usrimg directory
6.  created a new page in snews and inlcuded the gallery.php file

is that everything?

i don't see any pictures.  just the default "whatever this gallery title is" message

can anyone help?

thanks

i think i'm getting there.  all my images were jpg its working with other image types.  needed to add jpg to is-image-extension function
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #23 on: February 16, 2007, 03:35:47 PM »

Quote from: ld3
i can't get this working.  this is what i've done so far

1.  put gallery.php in my snews root directory
2.  put the css into a file called gallery.inc.css also in the root snews directory
4.  added /usrimg directory to the snews root
5.  added /gallery directory to the usrimg directory
6.  created a new page in snews and inlcuded the gallery.php file

is that everything?

i don't see any pictures.  just the default "whatever this gallery title is" message

can anyone help?

thanks

i think i'm getting there.  all my images were jpg its working with other image types.  needed to add jpg to is-image-extension function
Ahem ... good to hear that :lol:

Feedback and suggestions welcome as I'm not CSS expert so there might be better approaches.
« Last Edit: September 24, 2007, 12:22:02 PM by codetwist »
Logged

ld3

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Simple PHP gallery
« Reply #24 on: February 16, 2007, 03:42:28 PM »

i got one more question now!  i'm getting the gallery images displayed but when i click on them to see the larger image i'm getting directed to a #nogo link.
i guess its this code here.....
 $strResult .= "<a href=\"#nogo\" title=\"$linkTitle\" style=\"margin-top:-$strTopMargin"."px; height:" . ($height+1)

do i need to change this to make the links work?
« Last Edit: January 22, 2008, 08:59:04 PM by Keyrocks »
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #25 on: February 16, 2007, 03:50:31 PM »

Quote from: ld3
i got one more question now!  i'm getting the gallery images displayed but when i click on them to see the larger image i'm getting directed to a #nogo link.
i guess its this code here.....
 $strResult .= "<a href=\"#nogo\" title=\"$linkTitle\" style=\"margin-top:-$strTopMargin"."px; height:" . ($height+1)

do i need to change this to make the links work?
Yes, as this thing is unfinished yet. It doesn't do more currently than what can be changed with configuration variables. Just static page :D

So, either add into php code whatever is needed to output what's needed for href or try some CSS tricks. I haven't yet made my mind up regarding further improvement of this addon.
« Last Edit: September 24, 2007, 12:22:34 PM by codetwist »
Logged

ld3

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Simple PHP gallery
« Reply #26 on: February 16, 2007, 04:01:32 PM »

ok.   i like the way lightbox displays images so i will try and amend it to display with lightbox.  thanks again
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Simple PHP gallery
« Reply #27 on: February 16, 2007, 04:59:09 PM »

There is another one, called Litebox (http://www.doknowevil.net/litebox/). Don't know a lot about it, but size is significantly smaller than Lightbox.
« Last Edit: September 24, 2007, 12:23:06 PM by codetwist »
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Simple PHP gallery
« Reply #28 on: April 13, 2007, 06:16:34 PM »

I really like this script. I just have one request for help, then I'm all set.
I need to set a link on the big image and on any thumbnail/main image that points to, in this case, another category within the site. Let me explain.

I'm working on my templates showcase, so I have a page in my sNews system, called Templates. That page is used to call in gallery.php. Obviously I have created a directory Templates, it is the root directory for all my template demos btw, and in that directory I have the image directory used by gallery.php for thumbnails and intro images etc. Now, I'm using the first version of Valdis' expanded simple script and it works perfectly. So, in the main process part, I've added the following to $strOutput:
Quote
$strOutput .= '<a href="'.db('website').'/'.$entryName.'" title="'.$entryName.'"><img class="'.$imgClass.'" src="'.$dirPath.$entryName.'" alt="'.$entryName.'" /></a> ' . chr(10);
            if( ($lineSize > 0) && !($i % $lineSize) ) {
               $strOutput .= '<br/>';
(I've added the a href bits to all $strOutput in process main so that all images gets a link.)

My problem? I need to strip out the file extension from $entryName to get the link to work as intended. (naming convention of images is same name as its corresponding template. Each template demo is in a subdirectory with that same name.) But -- how?
Help? ;)
« Last Edit: January 22, 2008, 08:59:46 PM by Keyrocks »
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Simple PHP gallery
« Reply #29 on: April 13, 2007, 08:35:00 PM »

Quote from: bakercad
something undecipherable
yeah, it looks like it would work very well ... but as you can see from the quote... :D
I don't know where to put it, sorry

Here's what the full code looks like from get_gallery_intro and down, including my <a href's, maybe that will make clearer why I don't know where to put the substr() bit...
Quote
function get_gallery_intro( $dirPath, $imgName = '*.*', $imgClass = '', $blockClass = '' ) {
   $strOutput = "";
   $strImgClass   = ($imgClass !== '')   ? " class=\"$imgClass\" " : "";
   $strBlockClass = ($blockClass !== '') ? " class=\"$blockClass\" " : "";
   if ( $imgName !== '*.*' ) {
      // Look for specified intro file
      if ( is_file( $dirPath . $imgName ) ) {
         $fileInfo = pathinfo( $dirPath . $entryName );
         if (is_image_extension( $fileInfo["extension"] )) {
            $strOutput = '<a href="'.db('website').'/'.$entryName.'" title="'.$entryName.'"><img '.$strImgClass.'src="'.$dirPath.$entryName.'" alt="'.$entryName.'" /></a>';
         }
      }
   }
   if ( $strOutput == '' ) {
      // Look for first image encountered (even if specific image was requested but failed to be found)
      $dirObj = dir( $dirPath );
      while (false !== ($entryName = $dirObj->read())) {
         if (is_file( $dirPath . $entryName )) {
            $fileInfo = pathinfo( $dirPath . $entryName );
            if ( is_image_extension( $fileInfo["extension"] ) ) {
               $strOutput = '<a href="'.db('website').'/'.$entryName.'" title="'.$entryName.'"><img '.$strImgClass.'src="'.$dirPath.$entryName.'" alt="'.$entryName.'" /></a>';
               break;
            }
         }
      }
      $dirObj->close();
   } // End while
   if ($strOutput !== '') {
      $strOutput = "<p$strBlockClass>$strOutput</p>" . chr(10);
   }
   return $strOutput;
}

function show_gallery_intro( $dirPath, $imgName = '*.*', $imgClass = '', $blockClass = '' ) {
   if ( $strIntro = get_gallery_intro($dirPath, $imgName, $imgClass, $blockClass) )
      echo $strIntro;
}

function is_image_extension( $strExtension = '') {
   if ( ($strExtension > '') && in_array( $strExtension, array( 'gif', 'png', 'jpg', 'jpe' ) ))
      return true;
   return false;
}
I tried squeezing it in to a few different places, a couple of different ways, but, again, see the quote at the beginning...
(I blame it on it being the 13th today :) )
« Last Edit: January 22, 2008, 09:00:08 PM by Keyrocks »
Logged
Pages: 1 [2] 3 4 5