PDA

View Full Version : Picture Layout Question


fashunphotog
05-15-2005, 10:03 AM
I'm using vBGarage 3.1.1 and have a question regarding the way the pictures load onto the page in Edit Mode. Is it possible to have them layer out as if they were in a table instead of side by side?

I'm allowing more than 6 pictures per user and it would be convenient if the pictures would line up say in a three by five table and not side by side left to right.

Is this possible?

Thanks! :-)

FaShUnPhOtOg

EDIT: Please see the picture example of what I require, thx

CrimsonGT
05-17-2005, 07:47 PM
I too am trying to figure out how to do this. I allow 9 images to be uploaded and I was hoping to figure out how to put them in a 3x3 table. I could probably do it if I could figure out how to refer to each image seperately but I am at a loss on that one. I am trying to figure out how to determine each picture ID or something of the sort.

wdarton
05-21-2005, 03:31 AM
heh...I just posted about the same thing, except that I'm trying to make a gallery of the pictures ....

sorry about the double post...

I'll keep hacking away at it till I figure it out, but I believe the data has to be returned from SQL in groups then inserted via a vbgarage_imagebits (or similar) template that returns one row at a time....

I'm shooting in the dark since its my first attempt at php editing, but if I come up with something I'll post it back

fashunphotog
05-23-2005, 02:12 PM
I'll keep hacking away at it till I figure it out, but I believe the data has to be returned from SQL in groups then inserted via a vbgarage_imagebits (or similar) template that returns one row at a time....

I find that in the portfolio (garage) view the images do stack into a table layout. When I go into Edit mode and change out editimagebits with imagebits however, nothing appears. Never mind about stacking up.... :ermm:

wdarton
05-23-2005, 05:31 PM
I ended up making a new file for the gallery (vbgarage_gallery.php) and new templates specifically for it, and got it to stack them out. I'm still cleaning it up a bit, but it works pretty good

CrimsonGT
05-23-2005, 07:26 PM
Hey Wdarton, do you have AIM or MSN? Your the first person I believe who has actually got this to work correctly and I would love to ask you a couple questions if you dont mind

wdarton
05-23-2005, 07:32 PM
drop me an email and I'll send you back the templates and code I used ....I'm all about sharing it with you guys. Too bad that other dude took his toys and went home..he had some nice code goin on there...and I'd certainly like to get my hands on how he did the multiple garages....

redninja@phoenixsportbikeclub.com

oh and this is what it looks like now. I'm working on pagination and some spacing tonight

fashunphotog
05-26-2005, 09:00 AM
still looks a bit dirty but I sent you an email asking for the templates... Good job! Thank you. :)

wdarton
05-26-2005, 10:07 AM
Like I Said. Still working on it...Apparently a bunch of people want this...

Give me a day or two more and I'll post the code up here. I don't mind sharing.

CrimsonGT
05-26-2005, 10:24 AM
wdarton is our new best friend lol.

get on AIM if you got a few minutes man.

wdarton
05-29-2005, 01:00 PM
all
I'm still working on this...sorry its taken me so long. My real job got in the way of working on this... (f'n firewalls....) anyway.. I'm just trying to clean it up. Until last week I'd never programmed anything in PHP (Visual C yes, PHP no), so I'm still learning some of the in's and out's of it.... I promise as soon as I have a working something thats clean code wise I'll post it up...

ok I think I got it....the code is a little crude and I will try and refine it, but here goes....

in vbgarage.php

find: <under List Garage>
globalize($_REQUEST, array('pagenumber' => INT, 'perpage' => INT));

replace with:
globalize($_REQUEST, array('pagenumber' => INT, 'perpage' => INT, 'perrow' => INT));

find: <under List Garage>
SELECT * FROM " . TABLE_PREFIX . "vbgarage_images ORDER BY vbgarageid DESC LIMIT 5

replace with:
SELECT vbgarageid,userid FROM " . TABLE_PREFIX . "vbgarage_images ORDER BY vbgarageid DESC LIMIT 10

(or however many results you want displayed...Just replace the 10 with whatever.

find: <under List Garage>
while ($latest = $DB_site->fetch_Array($result_latest))
{
eval('$latestbits .= "' . fetch_template('vbgarage_latestbits') . '";');
}

replace with:
$perrow = 0;
$pagethrow = 0;

while ($latest = $DB_site->fetch_Array($result_latest))
{
if ($perrow == 5)
{
$perrow = 0;
eval('$latestbits .= "' . fetch_template('vbgarage_latestbitsa') . '";');
eval('$latestbits .= "' . fetch_template('vbgarage_latestbits') . '";');

}
else
{
eval('$latestbits .= "' . fetch_template('vbgarage_latestbits') . '";');
$perrow = $perrow + 1;
}

}

Create a new template called vbgarage_latestbitsa and put a <tr> in it.


Like I said its kinda rough, and I don't guarantee that its gonna work everywhere. I'll help out if I can with your installation, just drop me an email or PM....

And if you're interested in the gallery, here's how I did it.

Near the top find:
// pre-cache templates used by all actions
$globaltemplates = array(
'vbgarage_editgarage',
'vbgarage_editimagebits',
'vbgarage_imagebits',
'vbgarage_listbits',
'vbgarage_listgarage',
'vbgarage_popup',
'vbgarage_viewgarage'
replace with
// pre-cache templates used by all actions
$globaltemplates = array(
'vbgarage_editgarage',
'vbgarage_editimagebits',
'vbgarage_imagebits',
'vbgarage_listbits',
'vbgarage_listgarage',
'vbgarage_popup',
'vbgarage_gallery',
'vbgarage_viewgarage'


Add this at the bottom of vbgarage.php
// ################################################## ##########################
// ############################# SHOW GALLERY #############################
// ################################################## ##########################

if ($_REQUEST['do'] == 'dogallery')
{
globalize($_REQUEST, array('gperrow' => INT));


// get the latest uploads for diplay
$gresult_latest = $DB_site->query("
SELECT vbgarageid,userid FROM " . TABLE_PREFIX . "vbgarage_images ORDER BY userid ASC
");

// load the latest bits template

$gperrow = 0;
$gpagethrow = 0;

while ($glatest = $DB_site->fetch_Array($gresult_latest))
{
if ($gperrow == 5)
{
$gperrow = 0;
eval('$glatestbits .= "' . fetch_template('vbgarage_gallerybitsa') . '";');

}
else
{
eval('$glatestbits .= "' . fetch_template('vbgarage_gallerybits') . '";');
$gperrow = $gperrow + 1;
}

}
$DB_site->free_result($gresult_latest);

// $pagenav = construct_page_nav($garagecount[garages],"vbgarage.php?$session[sessionurl]do=$_REQUEST[do]&perpage=$perpage");

$navbits = construct_navbits(array('' => 'vBGarage'));
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template('vbgarage_gallery') . '");');
}

Add a new template called vbgarage_gallery
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head><title>$vboptions[bbtitle] - $vbphrase[vbgarage]</title>
$headinclude
</head>
<body>
$header
$navbar
<br>
<table cellpadding="$stylevar[outerborderwidth]" cellspacing="0" border="0" class="tborder" width="$stylevar[tablewidth]" align="center"><tr><td>
<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tcat" colspan="5"><b>PSC Garage Gallery</b></td>
</tr>
<tr>
$glatestbits
</tr>
</table>
</td></tr></table>

<br />

$pagenav

$footer

</body>
</html>

Add a new template called vbgarage_gallerybits:

<td class="alt2"align="center"><a href="$vboptions[bburl]/vbgarage.php?do=view&amp;id=$glatest[userid]"><img src="$vboptions[bburl]/vbgarage.php?do=thumb&amp;width=100&amp;id=$glatest[vbgarageid]" border=0 /></a></td>

Add a new template called vbgarage_gallerybitsa:
<tr>

The link to access your gallery would then be http://www.yoursite.com/forums/vbgarage.php?do=dogallery


I think thats about it...

My biggest problem was figuring out how to get php/vbb to start a new TR after 5 images. I'm sure there's a cleaner way to do this, and will be happy to modify my code that way if someone can point it out.

fashunphotog
06-09-2005, 01:56 PM
Hey !

Sorry it's taken so long to get back to you. I've injured my back and was out of it for a while.

Good job! Though not quite what I needed when I originally posted. I need to be able to stack the images in the Edit section, not the listing section of the garage. Any idea if this will work there too?

Cheers!

Mike

wdarton
06-09-2005, 02:49 PM
ah got it.

I'm working on another mod fo Crimson (to display 1 image next to each garage in the garage list), and I'll throw this one in there while I'm working on it. That should be pretty easy...

fashunphotog
06-09-2005, 05:20 PM
I did install your mods and like the listing feature but I couldn't get the gallery working correctly. Not a big deal, though.... I just watned to try it out and wasn't sure if we'd use it anyway. I'll play with it some more later.

Ciao!

Mike

CrimsonGT
06-19-2005, 10:33 AM
ah got it.

I'm working on another mod fo Crimson (to display 1 image next to each garage in the garage list), and I'll throw this one in there while I'm working on it. That should be pretty easy...

Hey man, im about to go to sleep but did you ever make any progress on that? Im still very excited :nervous: