Jump to content

php images gallery


AviNahum

Recommended Posts

hey,

i made an simple images gallery...

i'm using this code:

<?php

public function album_right($id, $s) {
global $cms, $DB, $std;

$DB->query("SELECT * FROM cms_gal_images WHERE album={$id}");
$c = $DB->get_num_rows();

$z = $c/100;

$count = 0;

while ($r = $DB->fetch_row())
{
$b = ''.$cms->admin_dir.'/gallery/'.$r['url'].'';
$a .= '<td width="'.$z.'%" align="center"><div style="background-color: #f3f3f3; border: .75pt solid #CCCCCC; padding: 4px;"><img src="'.$cms->admin_dir.'/gallery/'.$r['url'].'" width="'.$s['little_width'].'" height="'.$s['littile_h'].'" onclick="ch(this.src)"></div></td>';

$count++;

if ($count == $s['nprr'])
{
	$count = 0;
	$a .= "</tr><tr>";
}

}

return <<<EOF

<script type="text/javascript">

function ch(str)
{

var x=document.getElementById("big")
x.src=str;

}

</script>

<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">

<table width="100%" cellpadding="1" cellspacing="0">
<tr>{$a}</tr>
</table>

</td>
<td width="1%"></td>
<td valign="top">

<div align="center" style="background-color: #f3f3f3; border: .75pt solid #CCCCCC; padding: 4px;">
<img src="{$b}" width="{$s['big_width']}" height="{$s['big_h']}" id="big">
</div>

</td>
</tr>
</table>

EOF;
}

?>

 

its simple, i select all the images from the DB and display them on the side of the screen on small width...

at the center of the screen there are big image and when you press one of the small images, the big will

be replaced with the image you choose...

my code works fine...

 

but in the images table, there another colum that stores for each image some description...

my problem is to display the description for each image and when the big image changes so the description

changes to...

i wasn't sure if it's belong to PHP or JS so i posted it here...

 

Thanks!

 

***sorry for poor englsih***

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.