gallery help
Moderator: General Moderators
-
regularguy
- Forum Newbie
- Posts: 6
- Joined: Sat Nov 28, 2009 11:13 pm
gallery help
Hi,
somebody send me this script (below) to make gallery for my site, it works well!
I just wondering, if some one can help me on how to make clicked thumbs open (the big picture) on the new windows?
.... click the big picture back to the thumbs? or new template windows?
THANKS. and happy holidays !!!!!!!!
<?php
error_reporting(E_ALL);
if(!is_dir('thumbs')) die('thumbs directory was not found');
$file_list = array();
if ($handle = opendir('thumbs')) {
while (false !== ($file = readdir($handle))) {
if (strtolower(array_pop(explode('.',$file))) == 'jpg') {
$file_list[] = $file;
}
}
closedir($handle);
}
$count = 0;
$total = count($file_list);
?>
<?php
sort($file_list);
foreach($file_list as $file) {
$path = 'thumbs/'.$file;
if(!is_file($file)) continue;
echo "<a href=\"{$file} \"><img src=\"{$path}\" class=\"pic\" alt=\"{$file}\"></a>
";
}
?>
somebody send me this script (below) to make gallery for my site, it works well!
I just wondering, if some one can help me on how to make clicked thumbs open (the big picture) on the new windows?
.... click the big picture back to the thumbs? or new template windows?
THANKS. and happy holidays !!!!!!!!
<?php
error_reporting(E_ALL);
if(!is_dir('thumbs')) die('thumbs directory was not found');
$file_list = array();
if ($handle = opendir('thumbs')) {
while (false !== ($file = readdir($handle))) {
if (strtolower(array_pop(explode('.',$file))) == 'jpg') {
$file_list[] = $file;
}
}
closedir($handle);
}
$count = 0;
$total = count($file_list);
?>
<?php
sort($file_list);
foreach($file_list as $file) {
$path = 'thumbs/'.$file;
if(!is_file($file)) continue;
echo "<a href=\"{$file} \"><img src=\"{$path}\" class=\"pic\" alt=\"{$file}\"></a>
";
}
?>
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: gallery help
target="_blank" to open in a new window. I don't know about the other because you will already have the thumbs open in the first window.
Code: Select all
echo "<a href=\"{$file}\" target=\"_blank\"><img src=\"{$path}\" class=\"pic\" alt=\"{$file}\"></a>
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
regularguy
- Forum Newbie
- Posts: 6
- Joined: Sat Nov 28, 2009 11:13 pm
Re: gallery help
That's give me some ideas!
THANKS !
THANKS !
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: gallery help
OHHHHHHHH
hey. use javascript to open a div with the selected image in it. that way you can style it make it pretty and apply scripts to it. opening a new window is so ugly
hey. use javascript to open a div with the selected image in it. that way you can style it make it pretty and apply scripts to it. opening a new window is so ugly
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: gallery help
Good point daedalus__! Just answering the question.daedalus__ wrote:OHHHHHHHH
hey. use javascript to open a div with the selected image in it. that way you can style it make it pretty and apply scripts to it. opening a new window is so ugly
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: gallery help
well that might be a little above his skill level but a good idea for the future
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: gallery help
Myself, I would probably link to a PHP file that outputs the img tag with whatever HTML I wanted though. And use the class for style:
Code: Select all
echo '<a href="show_image.php?image='.$file.'" target="_blank"><img src="'.$path.'" class="pic" alt="'.$file.'"></a>'; mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
regularguy
- Forum Newbie
- Posts: 6
- Joined: Sat Nov 28, 2009 11:13 pm
Re: gallery help
Hey,
You right that is above my level.
I just learning here, what can I say I'm 56 year old just start to learn php... just the regular guy.
I can't even figure it out to sort the photo so the new one will be on top... almost discouraging this php is.
Thanks for helps, this is a good forum and good people.
You right that is above my level.
I just learning here, what can I say I'm 56 year old just start to learn php... just the regular guy.
I can't even figure it out to sort the photo so the new one will be on top... almost discouraging this php is.
Thanks for helps, this is a good forum and good people.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: gallery help
Don't ever get discouraged. Work at it and come here if you need help.regularguy wrote:Hey,
You right that is above my level.
I just learning here, what can I say I'm 56 year old just start to learn php... just the regular guy.
I can't even figure it out to sort the photo so the new one will be on top... almost discouraging this php is.
Thanks for helps, this is a good forum and good people.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.