Author Topic: Random image: any ideas???  (Read 16391 times)

0 Members and 1 Guest are viewing this topic.

Offline |!^ AnGeL ^!|

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Random image: any ideas???
« Reply #15 on: August 23, 2005, 01:15:28 AM »
Ok,

How can I make the images scrolling in this code?

I try to add this code

Code: [Select]
echo "<marquee onmouseover='this.stop()' onmouseout='this.start()' scrollAmount='2' scrollDelay='6' direction='up' height='161' style='border: 1px solid #663300; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; text-align:center' width='158'>\n";
but it seems not a good looking

this is the full code with the scrolling

Code: [Select]
<?php
define
('ROOT_PATH''./');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}

$num_images 5;

$sql "SELECT a.image_id, a.image_date, a.cat_id, a.image_name, a.image_active, a.image_thumb_file
FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat="
.AUTH_ALL."
AND b.auth_viewimage="
.AUTH_ALL."
ORDER BY a.image_date DESC
LIMIT 
$num_images";
$result $site_db->query($sql);

while (
$row $site_db->fetch_array($result)){
$image_id $row['image_id'];
$cat_id $row['cat_id'];
#$image_name = $row['image_name'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<marquee onmouseover='this.stop()' onmouseout='this.start()' scrollAmount='2' scrollDelay='6' direction='up' height='161' style='border: 1px solid #663300; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; text-align:center' width='158'>\n";
echo 
"<center><table><tr><td width=120 align=center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><br/><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br></td><td class=main_td valign=top><b>$image_name</b></td></td></table></center>\n";
}
?>

any ideas??

TheOracle

  • Guest
Re: Random image: any ideas???
« Reply #16 on: August 23, 2005, 05:00:05 AM »
Did you followed the instructions from the topic I posted earlier ?

Offline |!^ AnGeL ^!|

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Random image: any ideas???
« Reply #17 on: August 23, 2005, 05:34:09 AM »
Yes I follow it step by step

Thank you for help me

Now I have this problem with the image table

I want to put the images inside one square and scrolling it from up to down but the code multiplying it on the images

I add this code

Code: [Select]
echo "<marquee onmouseover='this.stop()' onmouseout='this.start()' scrollAmount='2' scrollDelay='6' direction='up' height='161' style='border: 1px solid #663300; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; text-align:center' width='158'>\n";
Above this

Code: [Select]
echo "<center><table><tr><td width=120 align=center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><br/><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br></td><td class=main_td valign=top><b>$image_name</b></td></td></table></center>\n";
This is the code, can you see it

Code: [Select]
<?php
define
('ROOT_PATH''./');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}

$num_images 5;

$sql "SELECT a.image_id, a.image_date, a.cat_id, a.image_name, a.image_active, a.image_thumb_file
FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat="
.AUTH_ALL."
AND b.auth_viewimage="
.AUTH_ALL."
ORDER BY a.image_date DESC
LIMIT 
$num_images";
$result $site_db->query($sql);

while (
$row $site_db->fetch_array($result)){
$image_id $row['image_id'];
$cat_id $row['cat_id'];
#$image_name = $row['image_name'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<marquee onmouseover='this.stop()' onmouseout='this.start()' scrollAmount='2' scrollDelay='6' direction='up' height='161' style='border: 1px solid #663300; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; text-align:center' width='158'>\n";
echo 
"<center><table><tr><td width=120 align=center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><br/><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br></td><td class=main_td valign=top><b>$image_name</b></td></td></table></center>\n";
}
?>

TheOracle

  • Guest
Re: Random image: any ideas???
« Reply #18 on: August 23, 2005, 12:32:45 PM »
Quote

I want to put the images inside one square and scrolling it from up to down but the code multiplying it on the images


If you're talking about IFrames. No modifications is required to be done under PHP files. This could be simply added into your HTML categories template files. ;)