coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: hermannakruse on February 01, 2007, 07:18:13 PM

Title: Memory Overflow on Slideshow
Post by: hermannakruse on February 01, 2007, 07:18:13 PM
Hallo
I have a Gallary with over 2000 Pictures and a quick server.
When I'm on an Slideshow every Preloaded Picture makes the Memory Cusumption Bigger.

Ther Problem ist that every Pictuer is stored in an Array but never relased.

The Function

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

I would gess prealoding the Picture once and then realising it will do the work nearly as good becouse of the cache the browser has anyway.
Title: Re: Memory Overflow on Slideshow
Post by: Nibbler on February 01, 2007, 07:35:13 PM
Discussed here: http://forum.coppermine-gallery.net/index.php?topic=31945.0

To apply a limit as mentioned, change include/slideshow.inc.php

$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, -1, -1, false);

to for example

$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, 1000, -1, false);

Not tested though.
Title: Re: Memory Overflow on Slideshow
Post by: hermannakruse on February 02, 2007, 12:29:28 AM
The discusson on
http://forum.coppermine-gallery.net/index.php?topic=31945.0 (http://forum.coppermine-gallery.net/index.php?topic=31945.0)
is about server problem but my Problem ist the Client side

Each Picture more on Server side means some more Bytes to send to the client.

But for the Client each Picture meand one more Picture to hoals in Memory.

My Windows 2000 System with 1GB Memory told me it was out of Memory after seeing a few 100 Pictures from the PictureShow.
I Would geas changing the JavaScript

from

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

function runSlideShow(){
   if (xIE4Up){
            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 (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

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


to

function preLoadPic(index)
{
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                window.status=''
}

function runSlideShow(){
   if (xIE4Up){
            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


preLoad[j]=nothing

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

        pos = j

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


wold help more for my Problem.

Thanks
Title: Re: Memory Overflow on Slideshow
Post by: hermannakruse on February 02, 2007, 01:20:45 AM
One littel Update

I have testet it. Event if i had to change form
preLoad[j]=nothig

to
preLoad[j]=null

Have a look hear http://hak.mls20.de/mp/test.html (http://hak.mls20.de/mp/test.html)
Title: Re: Memory Overflow on Slideshow
Post by: hermannakruse on February 03, 2007, 11:04:06 PM
Quote from: hermannakruse on February 02, 2007, 12:29:28 AM
The discusson on
http://forum.coppermine-gallery.net/index.php?topic=31945.0 (http://forum.coppermine-gallery.net/index.php?topic=31945.0)
is about server problem but my Problem ist the Client side

Each Picture more on Server side means some more Bytes to send to the client.

But for the Client each Picture meand one more Picture to hoals in Memory.

My Windows 2000 System with 1GB Memory told me it was out of Memory after seeing a few 100 Pictures from the PictureShow.
I Would geas changing the JavaScript

from

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

function runSlideShow(){
   if (xIE4Up){
            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 (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

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


to

function preLoadPic(index)
{
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                window.status=''
}

function runSlideShow(){
   if (xIE4Up){
            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


preLoad[j]=null

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

        pos = j

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


wold help more for my Problem.

Thanks