Page 1 of 1

Shared tags

Posted: Wed May 31, 2006 5:41 am
by Dr.CSS
Elijah
can the  table_of_contents tag be made to look in a folder of images and spit out a of the images?...

Re: Shared tags

Posted: Wed May 31, 2006 2:20 pm
by Elijah Lofgren
mark wrote: Elijah
can the  table_of_contents tag be made to look in a folder of images and spit out a of the images?...
This code will list all files in the uploads/images/ folder.

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

echo 'this is the dir:'.$dir;
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
	if ($dh = opendir($dir)) {
		while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
			echo "<li>filename: $file </li>\n";
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';

Re: Shared tags

Posted: Wed May 31, 2006 3:23 pm
by Dr.CSS
i take it this is a UDT...
can i change this line to look in diff. folder..
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

like so...
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1';

oh yea where do i put this...
and what happened when i submitted this post 2 new things showed up across the top... a check mark and X graphic

Re: Shared tags

Posted: Wed May 31, 2006 7:20 pm
by Elijah Lofgren
mark wrote: i take it this is a UDT...
can i change this line to look in diff. folder..
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

like so...
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1';

oh yea where do i put this...
and what happened when i submitted this post 2 new things showed up across the top... a check mark and X graphic


Yes it's a User defined tag. Yes you can change the folder. Just make a new user defined tag and call it like normal. No idea about the check mark and X graphic.

Re: Shared tags

Posted: Fri Jun 02, 2006 1:42 am
by Dr.CSS
Cool....
can it do this.... maybe?



  thanks

Re: Shared tags

Posted: Fri Jun 02, 2006 2:28 am
by Elijah Lofgren
mark wrote: Cool....
can it do this.... maybe?



  thanks
You're welcome, thanks for saying thanks.  :)

This should do it.

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1/';
$url = './uploads/images/gallery1/';
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
	if ($dh = opendir($dir)) {
		while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
$pos = strpos($file, '.');
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//   echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
$extension = substr($file, $pos);
echo "<li><a href=".$url.$file.'" rel="lightbox"><img src="'.$url.$name.'_thumb'.$extension.'" /></a>'."</li>\n";
}

			
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';
Version that outputs thumb_vacation1.jpg format here (like CMSMS uses):  http://wiki.cmsmadesimple.org/index.php ... stpictures

Re: Shared tags

Posted: Fri Jun 02, 2006 4:45 am
by Dr.CSS
man that's real close want to see what you made  http://www.multiintech.com/index.php?page=image_gallery
the gallery already has thumbs so somethings are repeated with thumbs_thumbs.jpg but i'm hoping to figure it out...

  thanks again you da man!!  :D

Re: Shared tags

Posted: Fri Jun 02, 2006 5:42 am
by Elijah Lofgren
mark wrote: man that's real close want to see what you made  http://www.multiintech.com/index.php?page=image_gallery
the gallery already has thumbs so somethings are repeated with thumbs_thumbs.jpg but i'm hoping to figure it out...

  thanks again you da man!!  :D
You're welcome.  ;D

This code should do it:

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1/';
$url = './uploads/images/gallery1/';
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
$thumb1_pos = strpos($file, 'thumb_');
$thumb2_pos = strpos($file, '_thumb');
$pos = strpos($file, '.');
$extension = substr($file, $pos);
if ($thumb1_pos === false && '.jpg' == $extension && $thumb2_pos === false) {
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//   echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
echo '<li><a href="'.$url.$file.'" rel="lightbox"><img src="'.$url.$name.'_thumb'.$extension.'" /></a>'."</li>\n";
}
}
                        
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';

Re: Shared tags

Posted: Fri Jun 02, 2006 2:21 pm
by Dr.CSS
U R da Man man...
check it now...
1 last little favor, any way to pull the title from the title tribute/value whatever you call it when you right click an img. > properties > next tab > Summary  title:box
on MS you can give it a title...

oh BTW: did i say THANKS

Re: Shared tags

Posted: Fri Jun 02, 2006 4:02 pm
by Elijah Lofgren
mark wrote: U R da Man man...
check it now...
1 last little favor, any way to pull the title from the title tribute/value whatever you call it when you right click an img. > properties > next tab > Summary  title:box
on MS you can give it a title...

oh BTW: did i say THANKS
you're welcome. Looks very cool!  ;)

About the title attribute, maybe it could be done, but I'm really busy these days so I'm not gonna spend the time looking into it.
Maybe you could find out here: http://us2.php.net/manual/en/function.e ... d-data.php

Re: Shared tags

Posted: Sat Jun 03, 2006 5:02 am
by Dr.CSS
thanks  i'll look into it...
always wonder where to learn php

Re: Shared tags

Posted: Mon Jun 05, 2006 5:51 am
by Dr.CSS
Check it out i got the titles and i've got it running with the lightbox.js...
and i made the ImageGallery tag on the same page work with the lightbox.js, hacked the IG tag to make it work, only thing is it gets a bigger than thumbnail blank img. box behind the lightbox....

thanx  ;)

Re: Shared tags

Posted: Fri Jun 23, 2006 4:01 am
by Dr.CSS
Elijah...
have you seen the latest UDT with the new Lightbox v.2...

http://www.multiintech.com/index.php?pa ... orbit_pics

Re: Shared tags

Posted: Mon Nov 13, 2006 1:25 pm
by Caspar
EDIT: Ok, finally tested the Album module... no more questions:D :D :D

Elijah Lofgren wrote: Version that outputs thumb_vacation1.jpg format here (like CMSMS uses):  http://wiki.cmsmadesimple.org/index.php ... stpictures
Hi Elijah, hi Mark!

Elijah, is this one easy to fix? I use your udt from the link above, but something messes up the image links. When I click on a thumbnail I get:
The requested URL /uploads/images/testgallery/blumen_09.jpg" was not found on this server.
Is it something with the " at the end of the path? I'm on CMSMS 1.0.2 with page-query-URLs (though I'd like to use the tag with pretty URLs as well...)

Mark, this was the thread I was talking about in my email. Hope, emailing didn't bother you, it was just that I had lost the thread... and your site being really rich! ;)

Re: Shared tags

Posted: Mon Nov 13, 2006 2:11 pm
by Dr.CSS
Emailing me is no problem, this is the tag for that page, it has a that makes it diff. from the other one I think...
The one problem I had was that the thumbnails generated by Image Manager have the thumb_ on the beginning, thumb_red.jpg, and this needs them on the end, red_thumb.jpg, so I just renamed them...

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/sesame1/';  name of the folder
$url = './uploads/images/sesame1/';
echo '';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                    if ('file' == filetype($dir . $file)) {
$thumb0_pos = strpos($file, 'thumb_');
$thumb1_pos = strpos($file, '_thumb');
$pos = strpos($file, '.');
$extension = substr($file, $pos);
if ($thumb0_pos === false && '.jpg' == $extension && $thumb1_pos === false) {
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//  echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
echo '
'.$name.''."\n";
}
}
                     
                    }
      }
      closedir($dh);
  }
}
echo '';