forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: Slideshow Bob on September 02, 2006, 05:16:52 pm

Title: Self-contained Slideshow?
Post by: Slideshow Bob on September 02, 2006, 05:16:52 pm
Can anybody share a script they've created to make a (preferably random) slideshow from the CM albums?

I'm trying to set-up an HTML page that includes a fade-in/out slideshow.  Here's the hardcoded javascript that works for a non-CM app.  It allows for the slideshow to be called within an IFrame on a page.

<script>
var slideShowSpeed = 6000
var crossFadeDuration = 4
var Pic = new Array()

var a = 0
Pic[a++] = '0506a.jpg'
Pic[a++] = 'Museum.jpg'
Pic[a++] = 'Kitchen.jpg'
Pic[a++] = '0506f.jpg'
Pic[a++] = 'Tulip.jpg'
Pic[a++] = '0506h.jpg'
Pic[a++] = '0506j.jpg'
Pic[a++] = '0506k.jpg'
Pic[a++] = '0506l.jpg'
Pic[a++] = '0506m.jpg'
Pic[a++] = '0506p.jpg'
Pic[a++] = '0506q.jpg'


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()"> 
Title: Re: IFrame-able Slideshow?
Post by: vuud on September 02, 2006, 07:00:28 pm
I know nothing about iframes...  what part of that do you need cpmFetch to produce?  The list of images?  That can be done pretty easily.  Let me know if thats all you need.

Title: Re: IFrame-able Slideshow?
Post by: Slideshow Bob on September 02, 2006, 07:33:04 pm
>I know nothing about iframes...  what part of that do you need cpmFetch to produce?  The list of images?  That can >be done pretty easily.  Let me know if thats all you need.

That would definitely be helpful!  I guess ya really don't need an IFrame for this.  The code I uploded in the original message can be called with an IMG tag - for example:

<img src="0506a.jpg" name='SlideShow' width=230 height=229>

If would be ideal if there was a way to encapsulate the slideshow functionality so it would be callable in a similar way.  I'll bet something like that would be a very popular feature in a future version -- if it's not already in the works  :)

Title: Re: IFrame-able Slideshow?
Post by: vuud on September 03, 2006, 02:12:13 am
>I know nothing about iframes...  what part of that do you need cpmFetch to produce?  The list of images?  That can >be done pretty easily.  Let me know if thats all you need.

That would definitely be helpful!  I guess ya really don't need an IFrame for this.  The code I uploded in the original message can be called with an IMG tag - for example:

<img src="0506a.jpg" name='SlideShow' width=230 height=229>

If would be ideal if there was a way to encapsulate the slideshow functionality so it would be callable in a similar way.  I'll bet something like that would be a very popular feature in a future version -- if it's not already in the works  :)


I would really love to include this sort of functionality, at the least as an example for cpmfetch...  But I need a concrete example to start with. 

If I understand you, that IMG tag and the code above will work?  If so, I will work something up that feeds it or something.

Thanks for your contribution to the cause


Title: Re: IFrame-able Slideshow?
Post by: cgc0202 on September 03, 2006, 03:02:33 am

I would really love to include this sort of functionality, at the least as an example for cpmfetch...  But I need a concrete example to start with. 

If I understand you, that IMG tag and the code above will work?  If so, I will work something up that feeds it or something.

Thanks for your contribution to the cause

Wow, I requested something similar in the dev version page.  I do not want it to be an iframe though, but just like a traditional photobox, just like the one produced by the CPMFetch.  Here are some features that would go with it.  Let us start with one large photobox presented as the feature photo on a page:
.

.

.

.


If you can make the process  do a fade-in, fade out, so much the better.  Vuud, there was flash application that I saw which is even more complex, but can have more educational features.  I try to refrain from using "flash" applications because not everyone has, or some intentionally turn off their flash option.

CGC

Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 03, 2006, 05:04:54 am
Yah, the IFRAME thing was an (unintentional :) red herring.  I changed the subject to reflect that. Things will work s'long as the code can be called through an HTML tag.

I'm not sure what's needed for a more concrete example - but I can try to spell it out better.  Let's say we've got a gallery with 100 pics - pic001.jpg ... pic100.jpg where Category=1.   When placed in an HTML page outside of the CM directory, the following tag:

<img name='SlideShow' width=230 height=229 count=5  cat=1>

(or something similar to it)

will randomly pull/show 5 pictures from the category 1 gallery.   So, the first time the page is loaded, the following pictures might show up as a slideshow:

    pict053.jpg, pict010.jpg, pict070.jpg, pict037.jpg, pic078.jpg

where each picture overlays the next

the next time the page is loaded, the following pictures might show up as a slideshow:

    pict027.jpg, pict003.jpg, pict006.jpg, pict078.jpg, pict029.jpg

Any user who views the page will see a different random list of pics (as opposed to always getting the same 'random' list the first time they view the page)

Does that make any more sense?
Title: Re: Self-contained Slideshow?
Post by: vuud on September 03, 2006, 06:24:57 am

Alright, basically I like the idea of making an easy way to have a slideshow, or series or pictures, or something like that.

I also recognize there is probably a million ways to do it, and everyone will have his or her own favorite.

I also know next to squat about flash, although I did make a cool little thing once that I sent to my boss while promoting some internet stuff I wanted to do...  It bascially was all black, with big white letters fading in and out in sequence that said "Make the Internet your bitch"... then .... "Slap dat bitch".  All to some soothing Rob Zombie tune (I think it was Dragula).  Mind you it was all in fun, and I was much younger then.  It was funny though - and he did approve the project.

Anyway, I digress.

So I am going to probably work into CpmFetch some code that provides helpful calls to get image listings.  Pretty much I envision it to be another return type, so you can use it with all the functions already in place.

Something like:

$objCpm->setReturnType("ImageList");
$list = $objCpm->getRandomPhotos();

$list would then contain:
/path/image.jpg       Subtitle here if you wanted one

For each.

Then again, I already have a datatype that does all that except the full image path, so maybe I will just add that in there.  No sense in re-inventing something.  But this is all it takes currently to output the listing into that Pic[a++] format.

Code: [Select]
$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(1000, 1000, "");

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

So this would output the list.  Of course I did not test this, but the concept stands.  The most I would be integrating into CpmFetch directly is the getImageToUse call...

Now including it as a code fragment for people to put into web pages would be okay with me.  But I am not out to provide a fully working application like CPG...  this is developers library, not trying to be any more.  I want this to be a base for people to be creative from... make life easier, etc...

Anyway, thoughts?

Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 03, 2006, 07:26:12 am
Hmm, I think we're onto something here.  One detail that's eluding me though is how to combine the Javascript with the PHP.  Anybody have any ideas?
Title: Re: Self-contained Slideshow?
Post by: vuud on September 03, 2006, 03:10:07 pm
Hmm, I think we're onto something here.  One detail that's eluding me though is how to combine the Javascript with the PHP.  Anybody have any ideas?

You put your javascript in the page like normal, then put the php code where you want the list of images generated (the cpmfetch calls go smack in the middle of the javascript block)

Good?
Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 03, 2006, 03:48:15 pm
I wish it were that easy.  As far as I understand, PHP is server side and gets executed first.  Javascript is client side and kicks in afterwards.  However, having the two interact is possible - but complicated.

I wonder if it would make sense to do the whole enchillada in PHP?

P.S.  Just for laughs, I tried mixing the two, but it was definitely a no-go...   :(
Title: Re: Self-contained Slideshow?
Post by: vuud on September 03, 2006, 05:39:09 pm
I wish it were that easy.  As far as I understand, PHP is server side and gets executed first.  Javascript is client side and kicks in afterwards.  However, having the two interact is possible - but complicated.

I wonder if it would make sense to do the whole enchillada in PHP?

P.S.  Just for laughs, I tried mixing the two, but it was definitely a no-go...   :(


Yes, technically you are right.  However, you are also confused.

Think of it this way...

CLIENT REQUEST -> WEB SERVER -> LOADS PAGE IN SERVER -> EXECUTES PHP -> RETURNS TO CLIENT -> CLIENT EXECUTES JAVASCRIPT.

Okay, so the PHP executes on the server and creates all of those Pic[a++] lines for you, and places them into the content that is being returned.  So if you have a PHP page that has a bunch of HTML in the beginning of it, the client will see that first.

So yes, PHP is executing first (and on the server), but our PHP is generating javascript code for us to execute later on the client side.

I am trying to get a working copy, and I have it looking right, but for some reason its not running in my browser.  Will post an example page when I get it working.

Sigh




Title: Re: Self-contained Slideshow?
Post by: vuud on September 03, 2006, 08:10:34 pm
This works okay on my setup.  There is a bug in there that it starts off with a blank image, so if you really want it to look decent you have to set something in the image tag.

I would play around with it and fix that, but someone more versed in javascript could probably do it faster.

Hope this helps.

BTW: document.all is not really a great way to go - IIRC it was used to test for IE, but other browsers now support it... so future generations should fix that up.

Code: [Select]
<html>
<head>
<script>
var slideShowSpeed = 3000
var crossFadeDuration = 4
var Pic = new Array()
var a = 0

<?php
include "./cpmfetch.php";

// For 1.6.x releases you need to add your partial url into the cpm() call below.
$objCpm = new cpm();
$objCpm->cpm_setReturnType("resultset");
$data $objCpm->cpm_viewLastAddedMediaFrom(10001000"");


foreach (
$data as $row) {

//For 1.6.x versions uncomment the following line, then comment the one following it (add // to the start of the line)
// $imagename = $objCpm->cpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
   
$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[i] = new Image()
   preLoad[i].src = Pic[i]
}

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="" name='SlideShow'>

</body>
</html>
 

Edited after the post, thanks to slideshow bob (Ahhhh - I get it, funny name) for the suggestions.
Title: Re: IFrame-able Slideshow?
Post by: vuud on September 03, 2006, 08:23:12 pm
  • A more ideal case, is a random and automated presentation of photos, so that a visitor will not always be confronted with the same beginning to end, everytime (s)he revisits a page. A more complex presentation is one by flickr- as discussed here: http://forum.coppermine-gallery.net/index.php?topic=7920.0|%20flickr%20%22single%20photo%20box%22%20presentation (http://forum.coppermine-gallery.net/index.php?topic=7920.0|%20flickr%20%22single%20photo%20box%22%20presentation)

Use the cpmfetch random type functions like above


Quote
  • There are situations  however, where a series of photos need to be presented in sequence, for example this mating dance: http://www.bios.treasuresoftheinternet.org/ecos001/displayimage.php?album=12&pid=349&slideshow=5000  (http://www.bios.treasuresoftheinternet.org/ecos001/displayimage.php?album=12&pid=349&slideshow=5000). 

    Note: The above is an unpublished album, since I have yet to ask permission from the photographer before it could be shown to the public.  Also, the PhotoGallery itself is still in demo stage, and not ready for public viewing, so I will remove the link, after Vuud responds.

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?


Quote
  • The above two examples, random vs. sequential clearly indicates that both options must be available.  Personally, I think this may be more simply achieved through CPMFetch.

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.


Quote
  • I think this is doable already with CPMFetch, and I have seen it done in a number of automated slide show presentation.  This involves the presentation of photo, with its related text caption, photographer, and brief description.

I would think so... I am not sure how much data comes back in that call, you'd have to check.  You could probably access the subtitle routines directly like the getImageToUse call - then again, they may already be in there...

Nope, just checked - the descriptions for subtitles and alt are created during the rendering of the table, so they are not done for passing back a result set. 

Once you have a row back call something like this:
$caption = $objCpm->createDescription("Pattern of %a and stuff",$row);

I will probably add that to the dataset at somepoint in the future...

Quote
If you can make the process  do a fade-in, fade out, so much the better.  Vuud, there was flash application that I saw which is even more complex, but can have more educational features.  I try to refrain from using "flash" applications because not everyone has, or some intentionally turn off their flash option.

Fade in / fade out is an MS/IE thing which I don't use and don't have Windows to even test it on.  Your on your own there. :p  Like I mentioned before I will probably provide a reference implementation, but I don't want to make creating slideshows a big part of cpmfetch.

Vuud


Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 04, 2006, 09:37:32 pm
I'm probably doing something dumb (it won't be the first time :), but this code doesn't work on my site at all.  I've tried putting it into a file named test.html  and in a file named test.php.  I also tried changing the include from:
 include "./cpmfetch.php";

to

include "/Coppermine/cpmfetch/cpmfetch.php";

with no luck.  When I call it from the .htm file, all I get is a broken icon.  When I call it from the .php file, the page is just blank.  Any ideas?


This works okay on my setup.  There is a bug in there that it starts off with a blank image, so if you really want it to look decent you have to set something in the image tag.

I would play around with it and fix that, but someone more versed in javascript could probably do it faster.

Hope this helps.

BTW: document.all is not really a great way to go - IIRC it was used to test for IE, but other browsers now support it... so future generations should fix that up.

Code: [Select]
<html>
<head>
<script>
var slideShowSpeed = 3000
var crossFadeDuration = 4
var Pic = new Array()
var a = 0

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

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[i] = new Image()
   preLoad[i].src = Pic[i]
}

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="" name='SlideShow'></td>

</body>
</html>
 
Title: Re: Self-contained Slideshow?
Post by: vuud on September 04, 2006, 10:31:59 pm
I'm probably doing something dumb (it won't be the first time :), but this code doesn't work on my site at all.  I've tried putting it into a file named test.html  and in a file named test.php.  I also tried changing the include from:
 include "./cpmfetch.php";

to

include "/Coppermine/cpmfetch/cpmfetch.php";

with no luck.  When I call it from the .htm file, all I get is a broken icon.  When I call it from the .php file, the page is just blank.  Any ideas?



* It must be in a file named something with .php as the extension

* I did that using the development version, so if you are using the stable version:

This line:
$objCpm = new cpm();

Will need to have the partial URL to your CPG directory:
$objCpm = new cpm("/Coppermine");

(If that is indeed your CPG directory)

* The include :
include "./cpmfetch.php"

Must be correct so that it can find cpmfetch.php.  The one above assumes your page is in the same directory as cpmfetch.php.  Adjust it to reflect your particular slice of reality.

One last thing... when I run it, there is always a broken icon there for a few seconds before it switches.  Like I said, in that post - I did not tweak everything, just got the proof of concept working.

Vuud
Title: Re: Self-contained Slideshow?
Post by: Davide Renda on September 04, 2006, 11:14:50 pm
I was curious and tried this code (I use the dev 193 version). I've created a test.php file, chmoded it 755, placed in the cpmfetch directory and I have following errors:

- if I leave $objCpm = new cpm(); as it is I obtain a "simple" INTERNAL SERVER ERROR etc etc and nothing else

- even if I shouldn't, if I change $objCpm = new cpm(); into $objCpm = new cpm(/); (my cpg is on the root) I obtain
Code: [Select]
Parse error: parse error, unexpected '/', expecting ')' in /web/htdocs/www.daviderenda.com/home/cpmfetch/test.php on line 11
Any idea?
Title: Re: Self-contained Slideshow?
Post by: vuud on September 04, 2006, 11:55:14 pm
I was curious and tried this code (I use the dev 193 version). I've created a test.php file, chmoded it 755, placed in the cpmfetch directory and I have following errors:

- if I leave $objCpm = new cpm(); as it is I obtain a "simple" INTERNAL SERVER ERROR etc etc and nothing else

- even if I shouldn't, if I change $objCpm = new cpm(); into $objCpm = new cpm(/); (my cpg is on the root) I obtain
Code: [Select]
Parse error: parse error, unexpected '/', expecting ')' in /web/htdocs/www.daviderenda.com/home/cpmfetch/test.php on line 11
Any idea?

Well, for the latter issue... just putting a / inside the () will cause a problem.  You would want to enclose it in quotes at least.  But if your cpmfetch directory is inside your CPG directory (even if its in the root) do not use that.  Leave it blank.

Internal Server Error is pretty heavy.   If you can check your servers error and / or access logs for a clue as to why it is doing that.  Those errors are typically a configuration issue mostly, but can be other things.  Sometimes it is other things, but its wierd that PHP is parsing the file, then choking on something.



Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 05, 2006, 12:20:23 am
I have a feeling this must only be working with the development version.  I've tried a lot of variations (even putting the test.php in the cpmfetch directory) and all I get is a blank page.  A source view of the page seems to contain only the first few lines of the file - stopping right before the <?php line.

Ah well, showing the same 5 photos in a slideshow each time isn't all that bad...  :(

If anybody else runs across something workable, pls pass along.  thx!
Title: Re: Self-contained Slideshow?
Post by: vuud on September 05, 2006, 02:40:32 am
I have a feeling this must only be working with the development version.  I've tried a lot of variations (even putting the test.php in the cpmfetch directory) and all I get is a blank page.  A source view of the page seems to contain only the first few lines of the file - stopping right before the <?php line.

Ah well, showing the same 5 photos in a slideshow each time isn't all that bad...  :(

If anybody else runs across something workable, pls pass along.  thx!


Ah phooey, your right... the dev version syntax has changed on some of the calls... In the stable version these lines need to be modified:


Code: [Select]
$imagename = $objCpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
to

Code: [Select]
$imagename = $objCpm->cpm->getImageToUse($row['pFilepath'], $row['pFilename'] ,"normal_");
I think nothing else relevant has changed.

Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 05, 2006, 02:47:01 am
Hiya.  I wasn't using cpmFetch for anything else so I switched over to the development version.  I just posted some feedback in the development section.
Title: Re: Self-contained Slideshow?
Post by: 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.

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
Title: Re: Self-contained Slideshow?
Post by: vuud on September 05, 2006, 04:05:22 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

Code: [Select]
$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
Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 05, 2006, 04:13:26 am
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/'
Title: Re: Self-contained Slideshow?
Post by: 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.

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>
Title: Re: Self-contained Slideshow?
Post by: vuud on September 05, 2006, 04:57:58 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
Title: Re: Self-contained Slideshow?
Post by: Slideshow Bob on September 05, 2006, 05:01:23 am
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.
Title: Sequential Slideshow
Post by: cgc0202 on September 05, 2006, 03:46:03 pm
Hi Vuud,

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

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
Title: Re: Self-contained Slideshow?
Post by: 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:
Code: [Select]
<body onload="runSlideShow()">
Title: Re: Self-contained Slideshow?
Post by: vuud on September 08, 2006, 01:34:36 am
It is just me or is anyone else getting the error:  Line 53 Object expected

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

Wierd.  Not me.  Are you using some strange browser?  Forget the javascript above it or something?
Title: Re: Self-contained Slideshow?
Post by: shamrock on September 08, 2006, 03:30:58 pm
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:
Code: [Select]
<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:
Code: [Select]
<?php
include "cpmfetch.php";
$objCpm = new cpm("/cmg");
$objCpm->cpm_viewLastAddedMediaFrom(4,1,"album=1");
$objCpm->cpm_close();
?>
Title: Re: Self-contained Slideshow?
Post by: 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

Title: Re: Self-contained Slideshow?
Post by: phill104 on January 30, 2007, 09:31:51 pm
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.
Title: Re: Self-contained Slideshow?
Post by: vuud on January 30, 2007, 11:05:54 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 :)




Title: Re: Self-contained Slideshow?
Post by: phill104 on January 30, 2007, 11:12:26 pm
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>
 
Title: Re: Self-contained Slideshow?
Post by: RCurtis on May 02, 2007, 02:07:04 am
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".
Title: Re: Self-contained Slideshow?
Post by: ericr23 on September 19, 2007, 05:26:34 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?