Page 1 of 1

Very basic gallery

Posted: Sat Nov 26, 2005 1:38 pm
by Tibs
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 /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

Posted: Sat Nov 26, 2005 5:47 pm
by ner0
[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 /cry.gif\' class=\'bbc_emoticon\' alt=\':(\' />

Very basic gallery

Posted: Sat Nov 26, 2005 6:36 pm
by Tibs
That didn\'t work nero /blum.gif\' class=\'bbc_emoticon\' alt=\':P\' /> anyway thanks for the effort.

Very basic gallery

Posted: Sat Nov 26, 2005 9:20 pm
by ner0
what exactly went wrong, I didn\'t bet on it being perfect first time but a little more debug info would help?

Very basic gallery

Posted: Sun Nov 27, 2005 11:03 am
by Tibs
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]

Very basic gallery

Posted: Fri Dec 02, 2005 10:46 pm
by ner0
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 /blum.gif\' class=\'bbc_emoticon\' alt=\':P\' />

looks like you got it sorted /good.gif\' class=\'bbc_emoticon\' alt=\'(Y)\' />

Very basic gallery

Posted: Fri Apr 21, 2006 7:33 am
by Brock
hmm...

Just what I was looking for...Tibs reckon I could get a copy of your source?