nanostudio-org / nanogallery2

a modern photo / video gallery and lightbox [JS library]
https://nanogallery2.nanostudio.org
761 stars 112 forks source link

PreloaderDisplay : Cannot read properties of undefined (reading 'addClass') #370

Open 4m2c4bl3 opened 2 years ago

4m2c4bl3 commented 2 years ago

Describe the issue
I'm creating albums using nano photos provider 2. I get the initial display of the gallery (though the thumbnails seem to not be generating. this is another error). When I click on a gallery it simply loads forever. I get the error jquery.nanogallery2.min.js:28 Uncaught TypeError: Cannot read properties of undefined (reading 'addClass') at l.e.PreloaderDisplay (jquery.nanogallery2.min.js:28:1233)

Looking at the debug log, the jquery.nanogallery2.min.js file crashes at this line image ".nGY2TnImg" is undefined, instead there is a value ".nGY2TnImg2" in the object. image

I'm using php 7.2, with exif and gd installed.

and this is the html I have in my page: header:

    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/nanogallery2@3/dist/css/nanogallery2.min.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/nanogallery2@3/dist/jquery.nanogallery2.min.js"></script>

body:

<div id="my_nanogallery2" data-nanogallery2='{
                    "kind":             "nano_photos_provider2",
                    "dataProvider":     "nano_photos_provider2/nano_photos_provider2.php",
                    "thumbnailHeight":  150,
                    "thumbnailWidth":   150
                  }'></div>

and finally, here is the response from the .php file

{
  "nano_status": "ok",
  "nano_message": "",
  "album_content": [
    {
      "src": "",
      "title": "amicable",
      "description": "",
      "tags": "",
      "ID": "amicable",
      "albumID": "0",
      "kind": "album",
      "t_url": [
        "nano_photos_content/amicable/127334303590_0.png",
        "nano_photos_content/amicable/_thumbnails/127334303590_0_150_150.png",
        "nano_photos_content/amicable/_thumbnails/127334303590_0_150_150.png",
        "nano_photos_content/amicable/_thumbnails/127334303590_0_150_150.png",
        "nano_photos_content/amicable/_thumbnails/127334303590_0_150_150.png"
      ],
      "t_width": [
        "150",
        "150",
        "150",
        "150",
        "150"
      ],
      "t_height": [
        "150",
        "150",
        "150",
        "150",
        "150"
      ],
      "dc": "#ebebeb",
      "mtime": 1643397393,
      "ctime": 1643397393,
      "sort": "amicable",
      "dcGIF": "R0lGODdhAwADAIAAAP///wAAACwAAAAAAwADAAACA4R/BQA7",
      "cnt": 195
    },
    {
      "src": "",
      "title": "titles",
      "description": "",
      "tags": "",
      "ID": "titles",
      "albumID": "0",
      "kind": "album",
      "t_url": [
        "nano_photos_content/titles/152103573885.png",
        "nano_photos_content/titles/_thumbnails/152103573885_150_150.png",
        "nano_photos_content/titles/_thumbnails/152103573885_150_150.png",
        "nano_photos_content/titles/_thumbnails/152103573885_150_150.png",
        "nano_photos_content/titles/_thumbnails/152103573885_150_150.png"
      ],
      "t_width": [
        "150",
        "150",
        "150",
        "150",
        "150"
      ],
      "t_height": [
        "150",
        "150",
        "150",
        "150",
        "150"
      ],
      "dc": "#746068",
      "mtime": 1643397414,
      "ctime": 1643397414,
      "sort": "titles",
      "dcGIF": "R0lGODdhAwADAKIAAOjl5ptHNv///0s/SnprewAAAAAAAAAAACwAAAAAAwADAAADBgghQ/IiAQA7",
      "cnt": 7
    }
  ],
  "nanophotosprovider": "1.2"
}

I'm running it from a local python server so I have no place to demo it online. I hope the information I provided is enough!

4m2c4bl3 commented 2 years ago

I copied the jquery.nanogallery2.min.js file and replaced all instances of nGY2TnImg with nGY2TnImg2, and that seems to work. The thumbnails are still not generating, but I can open the galleries and see the images without anything crashing.