Self-contained Slideshow? - Page 2 Self-contained Slideshow? - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Self-contained Slideshow?

Started by Slideshow Bob, September 02, 2006, 05:16:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Slideshow Bob

#20
OK, now I see what's going on.  For starters, the script can work with the development code.  However, it needs to be adjusted slightly.

the image stmt needs to be changed from: <img src="" name='SlideShow'>
to:  <img src="xxx" name='SlideShow'> where xxx is the url of the 1st random image generated by the PHP script.

somehow, a <blockquote></blockquote> stmt gets inserted before the PIC[a++] stmts. that should come out.  There are also a number of PIC statements where the picture name and part of the url is blank.

be sure to include a </head> stmt in the html.  In add'n, there's a </td> tag towards the end of the html which should be removed

vuud

Quote from: Slideshow Bob on September 05, 2006, 03:12:36 AM
OK, now I see what's going on.  For starters, the script can work with the development code.  However, it needs to be adjusted slightly.

the image stmt needs to be changed from: <img src="" name='SlideShow'>
to:  <img src="xxx" name='SlideShow'> where xxx is the url of the 1st random image generated by the PHP script.


Yep, I mentioned that with the code I posted.  I was thinking someone could rig up something in the javascript to set that right off the bat, instead of hard coding the src tag.

Quote
somehow, a <blockquote></blockquote> stmt gets inserted before the PIC[a++] stmts. that should come out.  There are also a number of PIC statements where the picture name and part of the url is blank.

Yeah, I noticed that also - fixed in the dev version I am working on now... if you want to get rid of it, open up cpmfetch_dao.php in an editor and search for

$this->debugPrint(mysql_error($this->dbconnection));

Then comment it out with // in front of it.

That was actually a pain to find...   

Quote
be sure to include a </head> stmt in the html.  In add'n, there's a </td> tag towards the end of the html which should be removed

Your right - sloppy html on my part.  I will edit my original post of the solution with this...

Thanks
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Slideshow Bob

whoohoo!  It works!

Is there a way to get rid of the random blank filename/urls?  If so, then it'll work 100%

Here's an example of one of 'em:

Pic[a++]='http://www.mysite.org/coppermine//images/'

Slideshow Bob

Here's some updated (working) code.  It fixes the symptom of the blank file URL, but not the cause.

Note: it only seems to work when called directly from the cpmfetch directory.  Even when adjusting the include variable...

<script>
var slideShowSpeed = 9000
var crossFadeDuration = 5
var Pic = new Array()
var a = 0

<?php
include "./cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewRandomMediaFrom(1000, 1000, "");
$counter=0;

foreach ($data as $row) {
   $imagename = $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   if(substr($imagename,strlen($imagename)-1,1)=="/")continue;
   if($counter++ > 20)break;
   print "Pic[a++]='" . $imagename . "'\n";
}
?>

var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad = new Image()
   preLoad.src = Pic
}

function runSlideShow(){

  if (document.all){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
  }

  document.images.SlideShow.src = preLoad[j].src

  if (document.all){
     document.images.SlideShow.filters.blendTrans.Play()
  }

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>

vuud

Quote from: Slideshow Bob on September 05, 2006, 04:49:02 AM
Here's some updated (working) code.  It fixes the symptom of the blank file URL, but not the cause.

Where is the blank url coming from?  Is it in the original data like cpmfetch is producing an empty row at the beginning or end?

Arrghh
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Slideshow Bob

it's comming from the call.  My guess is, there's some minor strangeness in the database.  However, if it's in mine, it's probably elsewhere too.  The bandaid fix seems to work ok.

cgc0202

Hi Vuud,

Let me clarify this point only, since the others require just patience until the features become available.

Quote from: vuud on September 03, 2006, 08:23:12 PM
I dunno... once you retrieve the data you could use php to sort it by filename or something?  Are you assuming they were added into CPG in the correct order?

For your case I guess it clearly must be available, but this is the first case that actually demonstrated needing that that I have seen...  so its not exactly a commonly requested thing.  Sorting the results is on the scope, so maybe that would solve your problem.

Vuud

Yes, I see no other way, but to manually arrange a set of photos before they are upoaded, so that they are in the correct order of the sequencea by adding 01, 02, 03, etc.. to the photoset has to be in sequence.  That was how I made it to run in sequence also in the CPG.

CGC

shamrock

It is just me or is anyone else getting the error:  Line 53 Object expected

My code for line 53 is:
<body onload="runSlideShow()">

vuud

Quote from: shamrock on September 07, 2006, 05:35:13 PM
It is just me or is anyone else getting the error:  Line 53 Object expected

My code for line 53 is:
<body onload="runSlideShow()">

Wierd.  Not me.  Are you using some strange browser?  Forget the javascript above it or something?
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

shamrock

I'm using Internet Explorer for now and I've copied the script above...my cpmFetch folder is inside coppermine (cmg is the directory).  I'll paste my code below:
<html>
<head>
<script>
var slideShowSpeed = 9000
var crossFadeDuration = 5
var Pic = new Array()
var a = 0

<?php
include "./cpmfetch.php";
$objCpm = new cpm("/cmg");
$objCpm->cpm_setReturnType("resultset");
$data $objCpm->cpm_viewRandomMediaFrom(10001000"");
$counter=0;

foreach (
$data as $row) {
   
$imagename $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   if(
substr($imagename,strlen($imagename)-1,1)=="/")continue;
   if(
$counter++ > 20)break;
   print 
"Pic[a++]='" $imagename "'\n";
}
?>


var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad = new Image()
   preLoad.src = Pic
}

function runSlideShow(){

  if (document.all){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
  }

  document.images.SlideShow.src = preLoad[j].src

  if (document.all){
     document.images.SlideShow.filters.blendTrans.Play()
  }

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
</head>
<body onload="runSlideShow()">

<img src="./cmg/displayimage.php?album=1&pos=0" name='SlideShow'>

</body>
</html>


The error I get is: Line 53 - object expected

By the way, I've verified that my cpmFetch is working properly by running the test.php file and the pictures display fine...the code for it is as follows:
<?php
include "cpmfetch.php";
$objCpm = new cpm("/cmg");
$objCpm->cpm_viewLastAddedMediaFrom(4,1,"album=1");
$objCpm->cpm_close();
?>

niks_007

hi
      i found this thread after searing so much its gr8 but the only problem is with the first image is not opened it shows a cross there then it wirks fine. i just cant understand why its having such problem i have tried altering the code but not found solution can some other java script code can work with it. i just wonder.

its live demo is here i have fetched the thumb images.
http://www.lakesparadise.com/test1.php

Niks


phill104

I've not installed cpmfetch before but this item interests me. I'm going to try to install now and I will report back how it goes.

Sorry to take up forum space but I'll get you prepared for my incompetence.
It is a mistake to think you can solve any major problems just with potatoes.

vuud

Quote from: niks_007 on December 20, 2006, 03:28:16 PM
hi
      i found this thread after searing so much its gr8 but the only problem is with the first image is not opened it shows a cross there then it wirks fine. i just cant understand why its having such problem i have tried altering the code but not found solution can some other java script code can work with it. i just wonder.

its live demo is here i have fetched the thumb images.
http://www.lakesparadise.com/test1.php

Niks



I think when we all got bored with poking it with a pointy stick thats where we were.  Should not be hard to fix, just no one sat down to do it.

Post a solution for future users if you find one please :)




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

phill104

I got everything to install properly and ver easy it was too. Brilliant job.

It's just doing slideshows that I cannot currently suss.

I keep getting the error on line 28 'preload[...].src' is null or not an object.

<html>
<head>
<script>
var slideShowSpeed = 3000
var crossFadeDuration = 4
var Pic = new Array()
var a = 0

<?php
include "./cpg133/cpmfetch.php";
$objCpm = new cpm("./cpg133");
$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(1000, 1000, "");

foreach ($data as $row) {
   $imagename = $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   print "Pic[a++]='" . $imagename . "'\n";
}
?>

var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad = new Image()
   preLoad.src = Pic
}

function runSlideShow(){

  if (document.all){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
  }

  document.images.SlideShow.src = preLoad[j].src

  if (document.all){
     document.images.SlideShow.filters.blendTrans.Play()
  }

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
<body onLoad="runSlideShow()">

<img src="./cpg133/displayimage.php?album=1&pos=0" name='SlideShow'></td>

</body>
</html>
 
It is a mistake to think you can solve any major problems just with potatoes.

RCurtis

I guess I am just not looking in the right place...  Is there any "final result" as to how to get this to work?  There are lot's of code samples sprinkled through this thread...but I can't seem to find "the final word".  Also, cannot find any docs on the file "slideshow.php" included in the 2.0 stable release.  It *appears* to be a possible end result to allow this... It runs without error, but only displays a small square with a red "X".

ericr23

Quote from: phill104 on January 30, 2007, 11:12:26 PM
<?php
foreach ($data as $row) {
   $imagename = $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   print "Pic[a++]='" . $imagename . "'\n";
}
?>

How would you get the link for each image, using similar code?