Upload Problems, Thumbnails don't work, directories can't be accessed

I have this strange issue on one album.

From time to time when I upload photos to a new directory everything gets corrupted under that particular directory tree.

for Instance if I were to create the following directory tree with images in each directory

/PhotoAlbum1
/PhotoAlbum1/sub1
/PhotoAlbum1/sub2
/PhotoAlbum1/sub3

sub2 may not be accessable, in setup if I drop down the gallery dropdown, to sub2, it will automatically change to sub3.

In the gallery sub2 will only show broken thumbnails, and if I click on it, the error log thinks I was access images in sub3. I also get a bunch of error in the error log.

It is like it gets confused on the directories and the directory listing gets corrupted.

It thinks I'm trying to access sub3 directory but actually clicking on sub2. And the file armon6.jpg in this instance is in a totally different directory the even the PhotoaAlbum1 directory.

errors below.

Warning
08/12/16 22:31:54 Division by zero
/home/denmel2/public_html/Album/main.php (Line:1505)
Warning
08/12/16 22:31:54 imagecreatefromjpeg(photos/PhotoAlbum1/sub3/armon6.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory
/home/denmel2/public_html/Album/main.php (Line:356)
Warning
08/12/16 22:31:54 imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions
/home/denmel2/public_html/Album/main.php (Line:1512)
Warning
08/12/16 22:31:54 imagecolorallocate(): supplied argument is not a valid Image resource
/home/denmel2/public_html/Album/main.php (Line:1514)
Warning
08/12/16 22:31:54 imagefill(): supplied argument is not a valid Image resource
/home/denmel2/public_html/Album/main.php (Line:1515)
Warning
08/12/16 22:31:54 imagecopyresampled(): supplied argument is not a valid Image resource
/home/denmel2/public_html/Album/main.php (Line:1517)
Warning
08/12/16 22:31:54 imagejpeg(): supplied argument is not a valid Image resource
/home/denmel2/public_html/Album/main.php (Line:369)
Warning
08/12/16 22:31:54 getimagesize(photos/PhotoAlbum1/sub3/armon7.jpg) [function.getimagesize]: failed to open stream: No such file or directory
/home/denmel2/public_html/Album/main.php (Line:1485)


style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8698264690166658"
data-ad-slot="4417389723">