Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Memory Overflow on Slideshow  (Read 4040 times)

0 Members and 1 Guest are viewing this topic.

hermannakruse

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Familie Kruse
Memory Overflow on Slideshow
« 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.
Logged

Nibbler

  • Guest
Re: Memory Overflow on Slideshow
« Reply #1 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

Code: [Select]
$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, -1, -1, false);
to for example

Code: [Select]
$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, 1000, -1, false);
Not tested though.
Logged

hermannakruse

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Familie Kruse
Re: Memory Overflow on Slideshow
« Reply #2 on: February 02, 2007, 12:29:28 am »

The discusson on
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

Code: [Select]
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

Code: [Select]
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
Logged

hermannakruse

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Familie Kruse
Re: Memory Overflow on Slideshow
« Reply #3 on: February 02, 2007, 01:20:45 am »

One littel Update

I have testet it. Event if i had to change form
Code: [Select]
preLoad[j]=nothig
to
Code: [Select]
preLoad[j]=null
Have a look hear http://hak.mls20.de/mp/test.html
Logged

hermannakruse

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Familie Kruse
Re: Memory Overflow on Slideshow
« Reply #4 on: February 03, 2007, 11:04:06 pm »

The discusson on
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

Code: [Select]
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

Code: [Select]
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
Logged
Pages: [1]   Go Up
 

Page created in 0.072 seconds with 20 queries.