Shared tags
Shared tags
Elijah
can the table_of_contents tag be made to look in a folder of images and spit out a of the images?...
can the table_of_contents tag be made to look in a folder of images and spit out a of the images?...
- Elijah Lofgren
- Power Poster

- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: Shared tags
This code will list all files in the uploads/images/ folder.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?...
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>';
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
Re: Shared tags
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
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
Last edited by Anonymous on Wed May 31, 2006 3:25 pm, edited 1 time in total.
- Elijah Lofgren
- Power Poster

- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: Shared tags
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.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
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
Re: Shared tags
Cool....
can it do this.... maybe?
thanks
can it do this.... maybe?
thanks
- Elijah Lofgren
- Power Poster

- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: Shared tags
You're welcome, thanks for saying thanks.mark wrote: Cool....
can it do this.... maybe?
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>';
Last edited by Anonymous on Fri Jun 02, 2006 2:33 am, edited 1 time in total.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
Re: Shared tags
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!!
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!!
- Elijah Lofgren
- Power Poster

- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: Shared tags
You're welcome.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!!![]()
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>';
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
Re: Shared tags
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
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
- Elijah Lofgren
- Power Poster

- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: Shared tags
you're welcome. Looks very cool!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
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
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
Re: Shared tags
thanks i'll look into it...
always wonder where to learn php
always wonder where to learn php
Re: Shared tags
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
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
Elijah...
have you seen the latest UDT with the new Lightbox v.2...
http://www.multiintech.com/index.php?pa ... orbit_pics
have you seen the latest UDT with the new Lightbox v.2...
http://www.multiintech.com/index.php?pa ... orbit_pics
-
Caspar
Re: Shared tags
EDIT: Ok, finally tested the Album module... no more questions!

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!
Hi Elijah, hi Mark!Elijah Lofgren wrote: Version that outputs thumb_vacation1.jpg format here (like CMSMS uses): http://wiki.cmsmadesimple.org/index.php ... stpictures
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!
Last edited by Caspar on Mon Nov 13, 2006 1:56 pm, edited 1 time in total.
Re: Shared tags
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 '';
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 '';

