Jump to content

NaN in gallery upload progress bar


phpony

Recommended Posts

The progress bar for multiple image uploader accepts only integer values, otherwise it displays NaN instead of current progress and scale is always at 0%. But gallery upload script returns float value as current step. If you upload 4 pics, everything will be fine - 25%, 50%, 75%, 100%. But if you upload 3 pics: 33.3333% => NaN, 66.6666% => NaN, 100%.

To fix this I've changed a line it \applications\gallery\modules\front\gallery\submit.php line 877:

return array( ++$offset, \IPS\Member::loggedIn()->language()->addToStack('processing'), 100 / ( \IPS\Request::i()->totalImages ?: $offset ) * $offset );

To:

return array( ++$offset, \IPS\Member::loggedIn()->language()->addToStack('processing'), intval(100 / ( \IPS\Request::i()->totalImages ?: $offset ) * $offset) );

And now uploader shows correct progress for any number of pics.

Link to comment
Share on other sites

26 minutes ago, phpony said:

Hmmm. Maybe this is specific to this Russian language pack here: Russian language for Invision Community - Translations - Invision Community

I'll look further.

Yes your thinking is on the right track, I encountered this a few weeks ago, it's specific to locales that use a comma for the decimal separator. It should be fixed in 4.5.5. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...