[SOLVED] Renaming gallery3 folder causes broken thumbnails

jelzo

Joined: 2008-04-10
Posts: 67
Posted: Wed, 2014-06-18 08:52

I have the following setup:

Version: 3.0.9 (Chartres)
Albums: 76
Photos: 1197

Hostnaam: s40.webhostingserver.nl
Besturingssysteem: Linux 2.6.32-531.11.2.lve1.2.55.el6.x86_64
Apache: Apache
PHP: 5.3.27
MySQL: 5.5.32-31.0-log
Serverbelasting: 1,22 1,11 1,19
Grafische toolkit: gd

I stuble upon the following behaviour:

- Rename /gallery3/ to /beeldbank/
- Upload a new image -> Thumbnail broken
- Rename /beeldbank/ to /gallery3/
- Upload a new image -> Thumbnail built successful
- Rename /gallery3/ to /beeldbank/
- Upload a new image -> Thumbnail broken

I have tested this and it happens with both the regular as the HTML5 upload form.

The logfile shows the following errors:

Quote:
2014-06-18 10:48:32 +02:00 --- error: Caught exception rebuilding images: IMG 0156
@todo UNREADABLE_FILE
#0 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/gallery_graphics.php(145): photo_Core::get_file_metadata('/nfs/home/deb83...')
#1 [internal function]: gallery_graphics_Core::composite('/nfs/home/deb83...', '/nfs/home/deb83...', Array, Object(Item_Model))
#2 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/graphics.php(171): call_user_func_array('gallery_graphic...', Array)
#3 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/gallery_event.php(126): graphics_Core::generate(Object(Item_Model))
#4 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/module.php(402): gallery_event_Core::item_created(Object(Item_Model))
#5 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/models/item.php(416): module_Core::event('item_created', Object(Item_Model))
#6 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/controllers/uploader.php(75): Item_Model_Core->save()
#7 [internal function]: Uploader_Controller->add_photo('2410')
#8 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Uploader_Controller), Array)
#9 [internal function]: Kohana_Core::instance(NULL)
#10 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/system/core/Event.php(208): call_user_func_array(Array, Array)
#11 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/application/Bootstrap.php(67): Event_Core::run('system.execute')
#12 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/index.php(116): require('/nfs/home/deb83...')
#13 {main}
2014-06-18 10:48:32 +02:00 --- error: @todo UNREADABLE_FILE
#0 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/gallery_graphics.php(145): photo_Core::get_file_metadata('/nfs/home/deb83...')
#1 [internal function]: gallery_graphics_Core::composite('/nfs/home/deb83...', '/nfs/home/deb83...', Array, Object(Item_Model))
#2 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/graphics.php(171): call_user_func_array('gallery_graphic...', Array)
#3 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/gallery_event.php(126): graphics_Core::generate(Object(Item_Model))
#4 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/helpers/module.php(402): gallery_event_Core::item_created(Object(Item_Model))
#5 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/models/item.php(416): module_Core::event('item_created', Object(Item_Model))
#6 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/modules/gallery/controllers/uploader.php(75): Item_Model_Core->save()
#7 [internal function]: Uploader_Controller->add_photo('2410')
#8 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Uploader_Controller), Array)
#9 [internal function]: Kohana_Core::instance(NULL)
#10 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/system/core/Event.php(208): call_user_func_array(Array, Array)
#11 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/application/Bootstrap.php(67): Event_Core::run('system.execute')
#12 /nfs/home/deb83333/domains/deneusproducties.nl/public_html/beeldbank/index.php(116): require('/nfs/home/deb83...')
#13 {main}

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2014-06-19 04:03

Sounds like some permission issue. But if renaming it back again should cause the same issue. Is the user you are renaming it as have permissions to read/write/execute the temp and var directories and permissions to use the image toolkit?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jelzo

Joined: 2008-04-10
Posts: 67
Posted: Tue, 2014-06-24 17:32

This is due to a bug in the watermarking module and affects all installations with watermarks. The path to your watermark will be hard-coded in the database, making it impossible to rebuild images. Due to this bug you will not be able to use your moved or migrated gallery!

There is a workaround:
After migrating, reapply your watermark.

And a possible fix will be:
1. In gallery3/modules/watermark/controllers/admin_watermarks.php on line 145, change:

          array("file" => VARPATH . "modules/watermark/$name",

To:

          array("file" => "modules/watermark/$name",  

2. In gallery3/modules/gallery/helpers/gallery_graphics.php on line 133, change:

      graphics::init_toolkit();

To:

      graphics::init_toolkit();

      if(!file_exists($options["file"])) {
        $options["file"] = VARPATH . $options["file"];
      }
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2014-06-24 18:28

Glad you got it sorted out and posted your findings. I have never used the watermark module before.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team