Hi,

I am encountering problems with the usage of tokens for the gallery directory settings in the latest dev (iirc this worked in previous versions):

As soon as I use a token of any kind (%gallery_name, %username etc.) node gallery will not rspect the directory setting any more. Example:

When I set the directory to e.g. "images/galleries" everything is fine and the images are uploaded correctly according to this setting.

If I set the path to e.g "images/galleries/%gallery_name" though, then node gallery uploads the images to a folder named "imagesgalleriesgalleryname" in the root directory (files).

Is this a bug or am I doing something wrong here? Thanks a lot in advance!

Comments

dbeall’s picture

it must be a bug of some sort. 6.x-2.x-dev (2009-Nov-08)
I just checked my files directory and it's doing almost the same.
it is omitting the '/'
the file path setting is ( members/%username/%gallery_name )
the file path shows as ( files/membersadminBuckeye_Lake_in_Winter )

EDIT: the galleries should be inside each members file folder or directory.
/files/members/admin/....gallery name ...
/files/members/Daveb/....gallery name ...

KerrySanto’s picture

I am still having problems with this, tried all possible combinations and I still cant get it to work

dbeall’s picture

well, I did a small test today using the 6.x-2.x-dev (Dec 15th) on a localtoast wampserver and it works as it should.. puts the files in the folders..
I will do another test tonight on a live site to see what happens..

Golem07’s picture

I did a new test with a fresh install of alpha11 and 2.x (2009-Dec-16) on both: xampp server and a live site. I get the same error everywhere. Could this be a conflict with another module maybe? Since some days ago you confirmed the bug but now it seems to be working with your installation dbeal.

dbeall’s picture

yes the error is or has happened on one of my sites, buckeyelake.org.
I am going to do a reinstall tonight on the buckeyelake.org site and see if it is still happening.
It could be a module conflict, there are over 130 modules in that site.

my test that worked was a fresh wamp install with just a handful of modules.

dbeall’s picture

well, the error is still there...
this sucks big time after a year and a half of trying different galleries for Drupal, I know this one will work.

I deleted all galleries, uninstalled the module, deleted the module folder, cleared all caches.
reinstalled the module using the 6.x-2.x-dev (Dec 15th) and the problem is still there.
There are still settings left behind by the module after fully uninstalling -another issue-

now I am trying to figure out plan number 5000

dbeall’s picture

since the galleries are messed up in the site anyway, I am going to try some old releases.
Edit:
I don't know why, but i am hunting for why this might be happening.. wish i knew how to trouble shoot it.
I have noticed that imagecache is also not showing the '/' in the token strings

dbeall’s picture

Ok, try this. I did not have transliteration installed on the buckeyelake.org website.

A shot in the dark after searching for hours in the api and hunting through the node_gallery code.
Just for fun(crossing fingers) and because I want node_gallery to work.. why? because I really like it.

I installed transliteration 6.x-3.0-rc1 because it has some new stuff(I'm a sucker for new stuff) and created a test gallery and Viola or woot,woot or whatever they say..

It works again

.. yipe

dbeall’s picture

BTW, the imagecache paths are also working now too.

dbeall’s picture

Just a heads up about the new transliteration 6.x-3.0-rc1 module, if you use the new one. It has some new settings available at:
(administer > Site configuration > File system) One of the settings is:

[x] Lowercase transliterated file names.
This is recommended to prevent issues with case-insensitive file systems.

If you have folder or directory names that use both lower and Upper Case Names, un-check this.
If it is left checked(default), it will create new folders or directories with all lower case names. Which will create a duplicate of the directory with a lower case name.
Example in my set up: the users have directories using their raw user name such as 'Daveb' and the setting if left checked will create 'daveb', which means that Dave now would have 2 directories.(not good)

justintime’s picture

That's an almost perl-like bug. Two characters was all it took to fix it!

When transliteration isn't installed, the code falls back to a simpler regex to strip bad characters out of the path. That code was stripping all the forwardslashes. I just committed the fix, so if you can't install transliteration (or don't want to), install the latest dev version of node gallery and it should fix it for you.

dbeall’s picture

Thanks justintime, I was looking at that stuff, but not having the knowledge to really see what was happening.. just started to try things..
If any one wants to edit without downloading::
In file node_gallery/node_gallery.pages.inc
Change this line @@29
$validated_path = preg_replace('/[^a-zA-Z0-9._]/', '', str_replace(' ', '_', $path));
To this::
$validated_path = preg_replace('/[^a-zA-Z0-9._\/]/', '', str_replace(' ', '_', $path));

justintime’s picture

Assigned: Unassigned » justintime
Status: Active » Fixed
Golem07’s picture

Thanks a lot for the fix and also thx to dbeal for really digging into the problem!

dbeall’s picture

ugh.. I'm a dummy and that sucks. Only thing I know real good is html and css. One of these days I will spend more time learning about the code in question before hunting for a workaround. But, every time something gets fixed by a real pro(justintime), I do learn something.

the reason I never found this error before is probably because I have always had transliteration installed due to running project/boost.

dbeall’s picture

I should add, for clean up of existing galleries, you can delete galleries and re-due them, or rework the files directory manually and then edit each file in the files table to add the '/'

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

millions’s picture

Status: Closed (fixed) » Active

This is still occurring for me with alpha 12. I checked the code from comment #12 in my file and the correction is there, but I'm still having issues with the files folder removing the /.

I've tried a few different things, also because I'm trying to implement Domain Access in the process and use their tokens to have galleries listed by subdomain.

I tried the following file paths:

[domain-subdomain]/[parent-node-gallery-title] resulted in a folder titled: domainsubdomainparentnodegallerytitle
%domain-subdomain/%gallery_name resulted in a folder titled: domainsubdomainte9
testimages/%gallery_name resulted in a folder titled: testimageste9

any ideas?

Thanks to all of you for your hard work. I love seeing such an actively maintained module! I wish I could help but my experience is limited to following directions and trial and error. no real development coding.

millions’s picture

Status: Active » Fixed

Sorry, this is due to the node gallery imagex module... http://drupal.org/node/689490

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.