Ok I coded this gallery for my website a while ago, I did evertyhing myself with some help from Vercz I think. Anyway I would like to get the images to show in 2 Rows instead of 1.
Here\'s the code, if you can you may improve it but then I would like to know what you change and why <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' /> so I learn something from it.
[code]<?php
if ($handle = opendir(\'Portfolio\')) {
while (false !== ($file = readdir($handle))) {
if ($file != \'.\' && $file != \'..\' && preg_match("/prev/",$file)) {
$open = str_replace("(prev)","",$file);
$show = str_replace(".jpg","",$open);
echo " <b> $show </b><br><a href=\"Portfolio/{$open}\" target=\"\_blank\"><img src=\"Portfolio/{$file}\" alt=\"\" border=\"0\" /></a><br><br>";
}
}
closedir($handle);
}
?>[/code]
Thanks In advance.
Very basic gallery
Moderators: Moderator, Global Moderator
Very basic gallery
[code]<?php
if ($handle = opendir(\'Portfolio\')) {
$numonrow = 0;
while (false !== ($file = readdir($handle))) {
if ($file != \'.\' && $file != \'..\' && preg_match("/prev/",$file)) {
//edit, check if we\'ve already output 2 images on this row. if so, start new row.
if ($numonrow == 2) {
echo "<br /><br />";
$numonrow = 0;
}
$numonrow++;
$open = str_replace("(prev)","",$file);
$show = str_replace(".jpg","",$open);
echo " <b> $show </b><br><a href=\"Portfolio/{$open}\" target=\"\_blank\"><img src=\"Portfolio/{$file}\" alt=\"\" border=\"0\" /></a>";
}
}
closedir($handle);
}
?>[/code]
try that, not sure if it\'s what you\'re going for, basically only added the 3 lines under the comment, also removed the default
after the image so it -should- put 2 per line, quite a while since i coded <img src=\'http://www.killanet.net/forum3/public/s ... #>/cry.gif\' class=\'bbc_emoticon\' alt=\':(\' />
if ($handle = opendir(\'Portfolio\')) {
$numonrow = 0;
while (false !== ($file = readdir($handle))) {
if ($file != \'.\' && $file != \'..\' && preg_match("/prev/",$file)) {
//edit, check if we\'ve already output 2 images on this row. if so, start new row.
if ($numonrow == 2) {
echo "<br /><br />";
$numonrow = 0;
}
$numonrow++;
$open = str_replace("(prev)","",$file);
$show = str_replace(".jpg","",$open);
echo " <b> $show </b><br><a href=\"Portfolio/{$open}\" target=\"\_blank\"><img src=\"Portfolio/{$file}\" alt=\"\" border=\"0\" /></a>";
}
}
closedir($handle);
}
?>[/code]
try that, not sure if it\'s what you\'re going for, basically only added the 3 lines under the comment, also removed the default
after the image so it -should- put 2 per line, quite a while since i coded <img src=\'http://www.killanet.net/forum3/public/s ... #>/cry.gif\' class=\'bbc_emoticon\' alt=\':(\' />
Last edited by ner0 on Sat Nov 26, 2005 5:48 pm, edited 1 time in total.
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <-
poor class
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Very basic gallery
That didn\'t work nero <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' /> anyway thanks for the effort.
...
Very basic gallery
what exactly went wrong, I didn\'t bet on it being perfect first time but a little more debug info would help?
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <-
poor class
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Very basic gallery
Hmm sorry \'bout that ner0, I\'m a bit sick and get annoyed quite fast then.
Anyway what went wrong is it placed the pics under each other but in steps.
Hmm way to hard to explain, just check
[url=\"http://tibs.killanet.net/Portfolio.html\"]http://tibs.killanet.net/Portfolio.html[/url]
Anyway what went wrong is it placed the pics under each other but in steps.
Hmm way to hard to explain, just check
[url=\"http://tibs.killanet.net/Portfolio.html\"]http://tibs.killanet.net/Portfolio.html[/url]
...
Very basic gallery
no worries, I didn\'t mean my last msg to sound short.. if it did then my bad, I just wanted to help dat all <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' />
looks like you got it sorted <img src=\'http://www.killanet.net/forum3/public/s ... >/good.gif\' class=\'bbc_emoticon\' alt=\'(Y)\' />
looks like you got it sorted <img src=\'http://www.killanet.net/forum3/public/s ... >/good.gif\' class=\'bbc_emoticon\' alt=\'(Y)\' />
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <-
poor class
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Very basic gallery
hmm...
Just what I was looking for...Tibs reckon I could get a copy of your source?
Just what I was looking for...Tibs reckon I could get a copy of your source?

