NextGEN Scroll Gallery on WordPress – Error on page: Warning: Division by zero
Few days back my hosting company send me a warning that disk space consumption on my server has hit 80%. I was shocked because no new client came on board. I became worried thinking if my server has been compromised or any account on the box has been hacked! I instantly logged into the server and tried to figure out the domain consuming disk space more than the allocated quota. Once I was able to figure out the domain, I instantly started analyzing it’s disk consumption folder wise. All this lead me to a error_log file which grew up to 18 GB in last 15 days time. This site has average 1500 visitors per day. I inspected the error_log to see which page is generating so many errors and to my surprise it was a page with NextGen Scroll Gallery. This gallery page was created two years ago and didn’t had an iota of any error till last 15 days. Now, the page was full of several lines showing following error:
Warning: Division by zero in nggScrollGallery.php on line 296
Of course, it had folder name etc. prepended to the script name (which I have omitted here due to same security reason). In order to try and solve this error, I created a new gallery page but it worked fine. I compared both the gallery page (the one which was generating errors and the newly created one). Everything was same except the gallery id. I created another page with same gallery id. This time the error showed up. So, the problem was with gallery.
I went to manage gallery option and re-generated the thumbnails but this didn’t solve the problem. Then I imported meta data for all the images in gallery. The next moment the gallery was working fine. Seems, somehow the meta data information for images in the gallery got corrupted or deleted. Re-importing this information solved the issue. After that I deleted the error_log and my disk consumption status also went back to normal.