novagallery icon indicating copy to clipboard operation
novagallery copied to clipboard

Image/Thumbnails in cache not being created

Open gareth-sfield opened this issue 2 years ago • 10 comments

Hi,

Have installed on local apache server PHP7+ and installed ok/updated init.php, .htaccess etc.

Home page loads but images/folders do not show up and right clicking on image placeholders says path is 'galleries/cache/400x400/' + [image1.jpg]/[image2.jpg] etc. (the test images I put in galleries)

The folders show up as '/album/albumA/' , /album/albumB/' for the two test folders I placed in galleries.

Looking in 'cache' folder there is a 'files.php' file that has been created and contains image refs but no '400x400' folder and cannot see an 'album' folder?

Also clicking on the placeholders launches the slideshow (can see left/right arrows etc) but no images again.

Hopefully can help!?

Many thanks.

gareth-sfield avatar Nov 04 '22 21:11 gareth-sfield

On self installed server it's most one of the following problems:

  • Is php-gd lib installed?
  • is htaccess support in apache config activated?
  • missing mod_rewrite in apache config
  • to less memory usage in php config
  • has the webserver the writing rights?

The "album" folder is just virtual for php request, it's not a real folder.

david-novafacile avatar Nov 06 '22 11:11 david-novafacile

If its a permission problem, you can try this:

https://github.com/novafacile/novagallery/issues/15#issuecomment-1229383114

david-novafacile avatar Nov 06 '22 11:11 david-novafacile

Apologies for late reply and thanks for getting back to me.

Checked all the permissions and everything seems ok/run other similar scripts on same setup/require same dependencies so not sure what the issue is?

Unfortunately on time restricted development for a client so will have another look in the future/when time permits as does look like a great solution!

Thanks again,

GS

gareth-sfield avatar Nov 23 '22 17:11 gareth-sfield

Having the same problem on php 8.2 FreeBSD 13.1. Installed in DocumentRoot. RewriteEngine and AllowOverride on in httpd.conf. No .htaccess (since it is in DocumentRoot, correct?). "album" virtual URLs are correctly rendering as full, correct path names to xxxxx/cache/400x400 -- but that directory never even created (though, as with Gareth, the files.php file has been made). GD and EXIF installed. It's like the scripts aren't even trying to make thumbnails. Setting cache=0 in site.php has no effect (other than suppressing creation of the "cache" direectories entirely).

All that aside, it looks like great code and design -- I just wish I could make it come to life! Thanks.

PatchyFog avatar Dec 28 '22 19:12 PatchyFog

If I make the 400x400 and 2000 directories manually and use ImageMagick to fill them with thumbnails, everything works. So it seems to be a problem with Image.php / GD. I will focus on that.

PatchyFog avatar Dec 28 '22 22:12 PatchyFog

Okay. There were 2 problems. Let me do the one on my end first (php 8.2):

filter_var was undefined in GImage::Image::load() around line 110 where it is trying to figure out if it should load the image from a URL. This caused an easy fatal error to debug. At first I thought it was because the invocation was written filter_var() and not \filter_var() to get out of the GImage namespace, but that didn't fix it, even though the fatal error message reflected the change of name. No, what it was, was that php82 mod_filter had to be manually installed even though it showed up as being already preinstalled in phpinfo().

But, I wasn't even getting that far because the app router was not dispatching the thumbnail GET because I had renamed the imagesDirName from 'galleries' to 'images' in site.php but 'galleries' was hard-coded in the router. So the change I made around line 14 was:

-// Gallery
- Router::add('/galleries/(.*)/cache/(.*)/(.*)', function($var1, $var2, $var3) {

+// Images Directory
+Router::add("/$imagesDirName/(.*)/cache/(.*)/(.*)", function($var1, $var2, $var3) {

And all is working now.

PatchyFog avatar Dec 29 '22 06:12 PatchyFog

Same issue here, tried on different servers (all extended with GD, correct rewrite config), appache, nginx, php7, php8... , all end up with the same result: album name shown correctly, but with no image above, the "/cache" foler was created with only one "files.php" in it, no thumbnails generated.

Please help.

yduke avatar Jan 15 '23 13:01 yduke

@PatchyFog Thanks for figure it out. I will check PHP 8.2 compatibility.

@yduke Do you use a self installed server or a webspace hosting. On self installed server it's most time a permissions problem, essentially if it doesn't work with different php versions. Do the webserver has write permissions at the galleries directory? There are two other common issues on self installed server: missing a php extension or missing htaccess support on apache respectively missing rewrite rules in nginx.

david-novafacile avatar Jan 15 '23 18:01 david-novafacile

Thank you very much David for replying. Good work first of all. I tested the novaGallery - Release 1.1.1 in 4 eviroments as below:

  1. A VPS, Linux with CentOS 7.9, Nginx 1.18, PHP 8.1.13, nova on site root folder;
  2. Same VPS as above, switched PHP to 7.4.33, nova on site root folder;
  3. XAMPP in Windows, with Apache 2.4.53, PHP 8.1.5, nova on site root folder;
  4. A Synology NAS (Linux), Nginx 1.20.1, PHP 7.3.3, nova on site root folder.

For thoses Nginxes, I copied your Nginx cofigs in #12 for rewrite, all test site can reach sub folder on web so I assume the rewrite is ok.

GD is ok because I have running-sites like WordPress on these severs metioned above, the gd extention had passed wordpress test and can be seen on phpinfo as well.

All sever turns out the same, folder name was right, but thumbnail empty cause images 404 on web.

Is that a permission problem? But the cache folder and files.php was successfully created by php, in this way php can write on the galleries folder right? I don't understand.

Thank you, That is all I know so far.

yduke avatar Jan 16 '23 04:01 yduke

Issue seems to be still OPEN. I just installed novaGallery and had the same situation: program starts, site.php seems to work, folder cache is created, file files.php is created but not thumbnail. Link to .../album/myImages is not resolved, gives 404 I did play with the folder permissions like described in issue #15 - no success

System info:

PHP Version => 8.0.28
System => Linux sh-71 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.11.1
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.6.37
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
JIS-mapped Japanese Font Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabled
Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1
gettext
GetText Support => enabled

Any help or ideas welcome.

RannerDesign avatar Nov 14 '23 15:11 RannerDesign