Home Articles CV / Résumé Downloads Photo Gallery Web LinksJuly 31 2010 22:17:26
View Thread
Adnan's Webspace | PHP Fusion | Infusions
Author Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 18-03-2007 10:18
Hey Adnan.

Thx for a grest Mods.

I have a little prob with your slideshow..

I can get it to show some pics, and another not..

You can se it here...
http://singleivejle.dk/photogallery.php

I have also notice that in a album i have tested with 3 images only one was to seen, the images was the same file format and size..

i am running with this slideshow.php

<?php
require_once "maincore.php";
if(isset($album_id) && isNUM($album_id)) {
$result = dbquery(
"SELECT ta.*, tu.user_id,user_name FROM ".$db_prefix."photo_albums ta
LEFT JOIN ".$db_prefix."users tu ON ta.album_user=tu.user_id
WHERE album_id='$album_id'"
);
$data = dbarray($result);
if (!checkgroup($data['album_access'])) {
fallback(BASEDIR."index.php");
} else {
?>
<center>
<form name="PlayForm">
<table>
<tr>
<td><input type="button" onclick="animImageDec();setCurrImage()" value="<<">
<td><input type="button" onclick="startPlayReverse()" value="<< Tilbage">
<td><input type="button" onclick="clearLastUpdate()" value="Stop">
<td><input type="button" onclick="startPlay()" value="Frem >>">
<td><input type="button" onclick="animImageInc();setCurrImage()" value=">>">
<td><input type="button" onclick="timeoutValue = parseInt(document.PlayForm.IntervalValue.value)" value="Skift Interval >>">
<td><input type="text" name="IntervalValue" style='width:40px;'>millisekunder</td></tr>
</table>

</form>

<?php

echo "<p>";

echo "<span style=\"display:none\">";

$results = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'");
$rows = dbrows($results);
while ($data = dbarray($results)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "<img src=\"".BASEDIR."gfx.php?full=n&photo_id=".$data['photo_id']."\">\n";
}
echo "</span>";

echo "<img name=\"MainImage\" src=\"".IMAGES."wait.jpg\" border=\"0\">
<script language=\"javascript\">";
$i = 1;
$results2 = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'");
while ($data = dbarray($results2)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "img".$i." = new Image();\n";
echo "img".$i.".src = \"".BASEDIR."gfx.php?full=n&photo_id=".$data['photo_id']."\";\n";
$i++;
}

echo "imgarray = new Array(".$rows.");";
$i = 1;
$results3 = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'");
while ($data = dbarray($results3)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "imgarray[".$i."] = new Image();\n";
echo "imgarray[".$i."].src = \"".BASEDIR."gfx.php?full=n&photo_id=".$data['photo_id']."\";\n";
$i++;
}

echo "var timeoutValue = 3000;
var animDelay = 1000;
var numOfImages = ".$rows.";

</script>";

?>


<script language="javascript">
var imageIndex = 0;
var timeoutID = 0;
var playMode = 1;


function animImageInc()
{
if (imageIndex < numOfImages)
imageIndex++
else
imageIndex = 1;
}

function animImageDec()
{
if (imageIndex > 1)
imageIndex--;
else
imageIndex = numOfImages;
}

function setCurrImage()
{
document.MainImage.src = imgarray[imageIndex].src;
}

function updateAnim()
{
var currTimeoutValue;

currTimeoutValue = timeoutValue;

if (playMode == 1)
{
animImageInc();
if (imageIndex == numOfImages)
currTimeoutValue += animDelay;
}
else
{
animImageDec();
if (imageIndex == 1)
currTimeoutValue += animDelay;
}
setCurrImage();
timeoutID = setTimeout("updateAnim()", currTimeoutValue);
}

function clearLastUpdate()
{
clearTimeout(timeoutID);
timeoutID = 0;
}

function startPlay()
{
clearLastUpdate();
playMode = 1;
updateAnim();
}

function startPlayReverse()
{
clearLastUpdate();
playMode = 2;
updateAnim();
}


updateAnim();

</script>


<script language="javascript">
document.PlayForm.IntervalValue.value = timeoutValue;
</script>

<form method="post">
<input type="button" value="Luk Slideshowet"
onclick="window.close()">
</form>
</center>
<?php
}
} else {
fallback(BASEDIR."index.php");
}
?>





BTW.
Does it have any effect if i use sub cats ?

Du you have the time for making a solution for my problems?

I also try testing on my localserver but without any solution.

best regards
offenbach
Edited by offenbach on 18-03-2007 10:36
Send Private Message
Author Sponsored Link
Advertisement


Author RE: Slideshow.
Adnan
Super Administrator

Posts: 80
Location: Montreal, Canada
Joined: 23.03.06
Posted on 18-03-2007 13:12
Hi,

I found the missing code, it wasn't not showing some pics, it was just showing them in a random order (not the one that was displayed in the photogallery).

Around line 38, find this
$results = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'";





replace with,
$results = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."' ORDER BY photo_datestamp";





that should do the trick, let me know if it doesn't work!

Adnan.
http://www.theadnanahmed.com Send Private Message
Author RE: Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 18-03-2007 13:26


I have replaced the code but on the site i was linking to it dosn't have any effect..
I have tryed to delete the photo's and upload some new and now it's shows 1 out of 3 i slideshow..

Send Private Message
Author RE: Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 18-03-2007 13:39
You can also se it on my mainpage
http://offenbach.dk/photogallery.php

it is on danish to but there are 3 gallery's the theme gallery with sub cats and thats Ok, but there are errors in the other 2 gallery's..
Edited by offenbach on 18-03-2007 13:41
Send Private Message
Author RE: Slideshow.
Adnan
Super Administrator

Posts: 80
Location: Montreal, Canada
Joined: 23.03.06
Posted on 18-03-2007 18:36
can you give me a structure dump of your photos table? wanna see how the structure is different with the sub-cats.
http://www.theadnanahmed.com Send Private Message
Author Sponsored Link
Advertisement


Location: Internet
Author RE: Slideshow.
Adnan
Super Administrator

Posts: 80
Location: Montreal, Canada
Joined: 23.03.06
Posted on 18-03-2007 18:38
can you post your exact slideshow.php file also, thanx!
http://www.theadnanahmed.com Send Private Message
Author RE: Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 18-03-2007 19:01
Hi again.
and thx for using your time on my prob..

I dont think that it is in the sub cat the fault is because [url]singleivejle.dk [/url]dosn't run with that, but here are my photo dump.

--
-- Struktur-dump for tabellen `fusion_photo_albums`
--

DROP TABLE IF EXISTS `fusion_photo_albums`;
CREATE TABLE IF NOT EXISTS `fusion_photo_albums` (
`album_id` smallint(5) unsigned NOT NULL auto_increment,
`album_title` varchar(100) NOT NULL default '',
`album_description` text NOT NULL,
`album_thumb` varchar(100) NOT NULL default '',
`album_user` smallint(5) unsigned NOT NULL default '0',
`album_access` smallint(5) unsigned NOT NULL default '0',
`album_order` smallint(5) unsigned NOT NULL default '0',
`album_datestamp` int(10) unsigned NOT NULL default '0',
`album_sub` mediumint(7) NOT NULL default '0',
PRIMARY KEY (`album_id`)
) TYPE=MyISAM AUTO_INCREMENT=15 ;

--
-- Data dump for tabellen `fusion_photo_albums`





And here are my slideshow.php

<?php
require_once "maincore.php";
define("SAFEMODE", @ini_get("safe_mode") ? true : false);

if(isset($album_id) && isNUM($album_id)) {
$result = dbquery(
"SELECT ta.*, tu.user_id,user_name FROM ".$db_prefix."photo_albums ta
LEFT JOIN ".$db_prefix."users tu ON ta.album_user=tu.user_id
WHERE album_id='$album_id'"
);
$data = dbarray($result);
if (!checkgroup($data['album_access'])) {
fallback(BASEDIR."index.php");
} else {
?>
<body bgcolor="#F8F8F8">
<center>
<form name="PlayForm">
<table>
<tr>
<td><input type="button" onclick="animImageDec();setCurrImage()" value="<<">
<td><input type="button" onclick="startPlayReverse()" value="<< Tilbage">
<td><input type="button" onclick="clearLastUpdate()" value="Stop">
<td><input type="button" onclick="startPlay()" value="Frem >>">
<td><input type="button" onclick="animImageInc();setCurrImage()" value=">>">
<td><input type="button" onclick="timeoutValue = parseInt(document.PlayForm.IntervalValue.value)" value="Skift Interval >>">
<td><input type="text" name="IntervalValue" style='width:40px;'>millisekunder</td></tr>
</table>

</form>

<?php

echo "<p>";

echo "<span style=\"display:none\">";

$results = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."' ORDER BY photo_datestamp" );
$rows = dbrows($results);
while ($data = dbarray($results)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "<img src=\"".PHOTODIR.$data['photo_thumb2']."\">\n";
}
echo "</span>";

echo "<img name=\"MainImage\" src=\"".IMAGES."wait.jpg\" border=\"0\">
<script language=\"javascript\">";
$i = 1;
$results2 = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'");
while ($data = dbarray($results2)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "img".$i." = new Image();\n";
echo "img".$i.".src = \"".PHOTODIR.$data['photo_thumb2']."\";\n";
$i++;
}

echo "imgarray = new Array(".$rows.");";
$i = 1;
$results3 = dbquery("SELECT * FROM ".$db_prefix."photos WHERE album_id='".$album_id."'");
while ($data = dbarray($results3)) {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
echo "imgarray[".$i."] = new Image();\n";
echo "imgarray[".$i."].src = \"".PHOTODIR.$data['photo_thumb2']."\";\n";
$i++;
}

echo "var timeoutValue = 3000;
var animDelay = 1000;
var numOfImages = ".$rows.";

</script>";

?>


<script language="javascript">
var imageIndex = 0;
var timeoutID = 0;
var playMode = 1;


function animImageInc()
{
if (imageIndex < numOfImages)
imageIndex++
else
imageIndex = 1;
}

function animImageDec()
{
if (imageIndex > 1)
imageIndex--;
else
imageIndex = numOfImages;
}

function setCurrImage()
{
document.MainImage.src = imgarray[imageIndex].src;
}

function updateAnim()
{
var currTimeoutValue;

currTimeoutValue = timeoutValue;

if (playMode == 1)
{
animImageInc();
if (imageIndex == numOfImages)
currTimeoutValue += animDelay;
}
else
{
animImageDec();
if (imageIndex == 1)
currTimeoutValue += animDelay;
}
setCurrImage();
timeoutID = setTimeout("updateAnim()", currTimeoutValue);
}

function clearLastUpdate()
{
clearTimeout(timeoutID);
timeoutID = 0;
}

function startPlay()
{
clearLastUpdate();
playMode = 1;
updateAnim();
}

function startPlayReverse()
{
clearLastUpdate();
playMode = 2;
updateAnim();
}


updateAnim();

</script>


<script language="javascript">
document.PlayForm.IntervalValue.value = timeoutValue;
</script>

<form method="post">
<input type="button" value="Luk Slideshow"
onclick="window.close()">
</form>
</center>
</body>
<?php
}
} else {
fallback(BASEDIR."index.php");
}
?>







I also have changes the file names but no, there is only certain images who will run in the slideshow..

Best regards
Offenbach
Edited by offenbach on 18-03-2007 19:03
Send Private Message
Author RE: Slideshow.
Adnan
Super Administrator

Posts: 80
Location: Montreal, Canada
Joined: 23.03.06
Posted on 18-03-2007 23:20
I just copied your code into my slideshow.php and its working fine ... i'll leave it up like that till you get a chance to have a look at it (look at any slideshow in any of my albums), the slideshow.php code is fine, its probably something else.

you gave me the structure dump for photo_albums table, can i get the one for fusion_photos?

Adnan.
http://www.theadnanahmed.com Send Private Message
Author RE: Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 19-03-2007 05:56
Hi Adnan.

Sorry i have read the thread wrong, here are the table you ask for.

--
-- Struktur-dump for tabellen `fusion_photos`
--

DROP TABLE IF EXISTS `fusion_photos`;
CREATE TABLE IF NOT EXISTS `fusion_photos` (
`photo_id` smallint(5) unsigned NOT NULL auto_increment,
`album_id` smallint(5) unsigned NOT NULL default '0',
`photo_title` varchar(100) NOT NULL default '',
`photo_description` text NOT NULL,
`photo_filename` varchar(100) NOT NULL default '',
`photo_thumb1` varchar(100) NOT NULL default '',
`photo_thumb2` varchar(100) NOT NULL default '',
`photo_datestamp` int(10) unsigned NOT NULL default '0',
`photo_user` smallint(5) unsigned NOT NULL default '0',
`photo_views` smallint(5) unsigned NOT NULL default '0',
`photo_order` smallint(5) unsigned NOT NULL default '0',
`photo_allow_comments` tinyint(1) unsigned NOT NULL default '1',
`photo_allow_ratings` tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (`photo_id`)
) TYPE=MyISAM AUTO_INCREMENT=18 ;

--
-- Data dump for tabellen `fusion_photos`
--

INSERT INTO `fusion_photos` (`photo_id`, `album_id`, `photo_title`, `photo_description`, `photo_filename`, `photo_thumb1`, `photo_thumb2`, `photo_datestamp`, `photo_user`, `photo_views`, `photo_order`, `photo_allow_comments`, `photo_allow_ratings`) VALUES
(8, 16, 'IMG5.JPG', '', 'IMG5.JPG', 'img5_t1.jpg', '', 1174246189, 1, 0, 5, 1, 1),
(14, 12, '247', '', '247_portal.jpg', '247_portal_t1.jpg', '247_portal_t2.jpg', 1174246306, 1, 0, 1, 1, 1),
(10, 16, 'IMG3.JPG', '', 'IMG3.JPG', 'img3_t1.jpg', '', 1174246190, 1, 0, 4, 1, 1),
(11, 16, 'IMG2.JPG', '', 'IMG2.JPG', 'img2_t1.jpg', '', 1174246190, 1, 0, 3, 1, 1),
(12, 16, 'IMG1.JPG', '', 'IMG1.JPG', 'img1_t1.jpg', '', 1174246190, 1, 0, 2, 1, 1),
(13, 16, 'IMG0.JPG', '', 'IMG0.JPG', 'img0_t1.jpg', 'img0_t2.jpg', 1174246190, 1, 0, 1, 1, 1),
(16, 12, '248', '', '248.jpg', '248_t1.jpg', '248_t2.jpg', 1174246342, 1, 0, 2, 1, 1),
(17, 12, 'Aphrodite', '', 'aphrodite.jpg', 'aphrodite_t1.jpg', 'aphrodite_t2.jpg', 1174246387, 1, 0, 3, 1, 1);




I have include the insert into and there i can se the error (wht havent i look for this before?) Silly me.

When i upload the fotos some files dosn't become a photo_thumb2
why i dont know, and when i changes taht in my DB and makes the files i work just great..

could the error be placed i the images? or do i have to look in the admin/photo.

I can see that the rights on some files when upload are 644 and some are 755..
Edited by offenbach on 19-03-2007 05:56
Send Private Message
Author RE: Slideshow.
Adnan
Super Administrator

Posts: 80
Location: Montreal, Canada
Joined: 23.03.06
Posted on 19-03-2007 14:26
Well at least we've found the source of the problem, its not in the slideshow feature, but from your photogallery itself ... weird. You are using the latest version of PHP-Fusion, right? compare your admin/photo to that in the CVS there might a small discrepency or something.

Adnan.
http://www.theadnanahmed.com Send Private Message
Author Sponsored Link
Advertisement


Location: Internet
Author RE: Slideshow.
offenbach
Member

Posts: 9
Joined: 18.03.07
Posted on 19-03-2007 14:52
Hi Adnan.

Yes i am using the latest one 6.01.8
and i am sure that it is an error i self has made, i have made som changes to my admin files so i could have massupload but ok, now i know where and how to change the files..

But it is very weird, when i upload images 640x512 there are no prob.
But when i upload some avatars the error is there..

Adnan thx again for your help and thx for great mods..
If there is anything i can help with just let me know...

Best regards from Denmark.
Send Private Message
Jump to Forum:

This site is optimized for viewing with Firefox!
All articles, pictures, and any other material obtained from this site is Copyright © 2007, and may not be reproduced without permission from the author.
Link Exchange - Directory - Windows Hosting