It works

kalle - October 3, 2007 - 09:41
Project:Flash gallery
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

See also closed bug-report http://drupal.org/node/99026.

Have the same problem with thumbs as X. Main image works.
1. have unique names (see discussion at http://drupal.org/node/99026)
2. updated image module.

Log says: Can't find system/files/images/flash/thumbs/bild30.preview.JPG, which is there and have 775 access property on the server. I tried to swith to HTTP-open instead of Private in the file system setting i Drupal (admin/settings/file-system), but that only made it worse. X everywhere!

#1

ariven - December 17, 2007 - 16:12

I am getting this same problem, and did some looking... my current file storage location is outside the server root directory.. for example : /var/www/virtual/www.ariven.com/files whereas the server resides in /var/www/virtual/www.ariven.com/html

Images are living here: /var/www/virtual/www.ariven.com/files/images
thumbnails were made by fgallery and exist here: /var/www/virtual/www.ariven.com/files/images/flash/thumbs

in my error logs it gives me errors like this:
Location http://www.ariven.com/system/files/images/flash/thumbs/silver-ninja.prev...
Message system/files/images/flash/thumbs/silver-ninja.preview.jpg

So, I created a directory under pageroot and copied the files that fgallery had made for thumbnails.. they now are copied to:

/var/www/virtual/www.ariven.com/html/system/files/images/flash/thumbs

And now the X's in the thumbnails have gone away, and they render... so for some reason the setup is making the thumbnails, but looking in the completely wrong location when it goes to access them.

in my file system configuration in admin, the path is as follows: /var/www/virtual/www.ariven.com/files

I dont see the word "system" in flash_gallery.module and dont know enough about the various system calls that are in use to know if one is being called wrong, or misspelled... or what.. :(

I was able to work around this problem by making the directory structure:

/var/www/virtual/www.ariven.com/html/files/images/flash and then making a symbolic link (ln -s) to /var/www/virtual/www.ariven.com/files/images/flash/thumbs which lets the server think the files are where its searching...but this is a bandaid method at best.

#2

kansas - December 22, 2007 - 08:19

I am having the same problem, but the thing is, images show when I'm logged in as an authenticated user, and they don't show when I am not logged in. This indicates to me that "system/files/" is being mapped by Drupal to the real folder (ie: /drupal/files or whatever you set "File system path:" to in Administer >> File system). You shouldn't create "system/files/images". I believe this problem all started when I switched the "Download method:" from "Public" to "Private" in Administer >> File System. The description of "Private" also supports my theory.

I believe it is a bug in the core authorization code.

Support, please confirm.

#3

ariven - December 26, 2007 - 15:06

Oh, I know I shouldn't create the extra "system/files/images" folder, I did it as a workaround to see what was going on, and get -something- working..

I have my download method set to private, and have not changed it to public. This is a brand new install of drupal, so there is no legacy issues in the database (i.e. swapping back and forth public/private/etc file downloads). I agree it looks like there is an authorization problem or a problem with getting the mapping to the private directory working while in the flash gallery. It might not be referencing the data the right way, because i have seen the /system/... style directories on private style file downloads, so it needs to be mapped out. Maybe the flash gallery isn't accessing the URL the right way for drupal to realise it needs to be mapped because I have seen this while logged in.

#4

bouddidje@drupa... - January 2, 2008 - 16:59

hello

I have the same problem, maybe since the last upgrade to drupal 5.5...but it's not sure

the only explaination I've found is in the includes/file.inc (last line)

switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case FILE_DOWNLOADS_PUBLIC:
      return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
    case FILE_DOWNLOADS_PRIVATE:
      return url('system/files/'. $path, NULL, NULL, TRUE);

So maybe it could come from the fact that we are in private for files system...???

#5

bouddidje@drupa... - January 2, 2008 - 17:39

hello

MAYBE I've found a solution:

- I've put the file system on open (maybe it is not necessary, but it avoid the error 'image not found in system/files/...') in Administration>settings>file system
- I've build a new thumbnails library in admin>settings>flash>miscellanous

Unfortunetely, when I put new image, flash gallery (or image gallery, or image attach, or...) don't create new thumbnails

SO: temporary solution is to build a new thumbnails library each time you add a new image !!

Have a good year ;)

#6

Openlogic - February 4, 2008 - 19:49

Looks like flash_gallery.module is not handling thumbnail creation when a new image is uploaded (image node type is created).

The solution would appear to be to add a call to the thumbnail creation function in the hook_nodeapi() function. Specifically, this worked for me:

Original:

function flash_gallery_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($node->type == 'image') {
    $images = $node->images;
    switch ($op) {
      case 'insert':
      case 'update':
        if ($images['preview']) {
          flash_gallery_check_dirs();
          if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
            $preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
            $thumb = file_create_path($images['thumbnail']);
            copy($thumb, $preview_name);
          }
        }
        break;
      case 'delete':
        if ($images['preview']) {
          flash_gallery_check_dirs();
          if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
            $preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
            unlink($preview_name);
          }
        }
        break;
    }
  }
}

Updated:

function flash_gallery_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($node->type == 'image') {
    $images = $node->images;
    switch ($op) {
      case 'insert':
        flash_gallery_rebuild_thumbs();  //  <-- added this line
      case 'update':
        if ($images['preview']) {
          flash_gallery_check_dirs();
          if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
            $preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
            $thumb = file_create_path($images['thumbnail']);
            copy($thumb, $preview_name);
          }
        }
        break;
      case 'delete':
        if ($images['preview']) {
          flash_gallery_check_dirs();
          if (flash_gallery_is_jpg(file_create_path($images['preview']))) {
            $preview_name = flash_gallery_image_path() .'/flash/thumbs/'. basename($images['preview']);
            unlink($preview_name);
          }
        }
        break;
    }
  }
}

#7

petrosilov - February 20, 2008 - 08:48
Title:Thumbs as X.» It works

Thanks fsiddiqi, this mod works for me 99%. Only the first picture in the gallery has not got thumbnail now. The others are OK.

#8

sime - April 1, 2008 - 23:45
Project:SWF Tools» Flash gallery
Version:5.x-1.x-dev» 5.x-1.x-dev
Component:Flash Gallery» Code

** Moving Flash Gallery issues to own queue **

 
 

Drupal is a registered trademark of Dries Buytaert.