Hello,
I wish I had this functionnality inside image_import module: the possibility to check an option that will copy the tree structure inside import folder to a Gallery/sub-galleries structure inside Drupal.
I didn't do anything yet, but I'm planning to start coding soon, and submit a patch quickly, to have your opinion.

Regards,
David

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David Stosik’s picture

Status: Active » Needs review
FileSize
4.89 KB

Here it is!

Please tell me what do you think of it, and whether you found bugs, or not.

David Stosik’s picture

FileSize
4.89 KB

Sorry, previous patch was buggy.
This one is OK.

How this works: put some images inside files/images/import, using subfolders. For example:

  • files/images/import/image1.jpg
  • files/images/import/subgallery1/image2.jpg
  • files/images/import/subgallery1/subgallery1-1/image3.jpg
  • files/images/import/subgallery1/image5.jpg
  • files/images/import/subgallery2/image6.jpg

Select a gallery (say, "containerGallery"), check the option "Reproduce folders structure with subgalleries", then click on "Import".
The following galleries will be created:

  • subgallery1, inside containerGallery
  • subgallery2, inside containerGallery
  • subgallery1-1, inside subgallery1

The images will go into corresponding galleries.
If anyone tests this, please give me your feedback.

Thanks,
David

Hetta’s picture

What an absolutetly splendid solution to all the various suggestions for tree structures!

David Stosik’s picture

Thank you very much! :)
Here is a new patch, to apply to original module. I corrected some bugs, and added the possibility to delete empty folders after import. :)

David Stosik’s picture

Anybody here?

volunteermama’s picture

promising idea! Just what I need.

Hetta’s picture

Yes - last time I tested 6.x things I didn't get anywhere, though. I'll give things another shot.

Hetta’s picture

Status: Needs review » Reviewed & tested by the community

Lovely, works a treat!
What it does, though, is add image galleries which correspond to the import directories.
It doesn't replicate the directory structure in the /images/ folder on the hard drive ... bummer.

David Stosik’s picture

It doesn't replicate the directory structure in the /images/ folder on the hard drive ... bummer.

This would also be a great feature It thought about it, but didn't do anything. For now, I would like to see if this patch can be integrated into image_import module... ;)

doc2@drupalfr.org’s picture

Yes please!!! Keep an eye here by the way:

#103793: Add token support for image file directory and image names

If ever you could commit this to a 5.x version as well, that would be Sooooooo great!

Kind regards!

druvision’s picture

Status: Reviewed & tested by the community » Needs work

nice idea. Not ready for production yet.

Hetta’s picture

Status: Needs work » Reviewed & tested by the community

?? The patch does exactly what it advertises: creates image galleries based on the file structure of the import folder.

How is this "not ready for production yet"?

Thanks ...

dman’s picture

Yeah, what's the actual objection?
Some code formatting like a half dozen whitespaces is about the only issue I can see from looking at it (although I've not actually run the code ;-)

David Stosik’s picture

Do you mean I should lighten my code with more whitespaces, or am I using them too much?

I also think this IS ready for production. My patch does clearly what I advertised, and as far as I tested, it doesn't introduce new bugs...

levavie, please be a little more explicit, what makes you think my patch needs work? If you don't tell me, I won't find by myself... :)

David

dman’s picture

Try using coder.module.
That'll tell you that "Drupal" expects

if ($form_state['values']['tree'] ) {
...
for ($i=0; $i<sizeof($requested_subgalleries); $i++) {

not

if( $form_state['values']['tree'] ) {
...
for($i=0; $i<sizeof($requested_subgalleries); $i++) {

:-)
Totally trivial, but there you go.
That's about it I think (wherever you see it)
;-)

David Stosik’s picture

I didn't know Drupal coding standards were so tight : I already contributed before, and had never been told my code was not compliant...
Hope this new version corrects the fault. :)

By the way, thanks for the coder module advice. It is very useful!

Hetta’s picture

OK, I can confirm that this patch still works a treat, no bugs, with importing images and displaying the resulting galleries.

(Image import says "# Created new gallery a-b." and "# Created new gallery c-e.", but it will import the images into existing galleries a-b and c-e without problems.)

David Stosik’s picture

So maybe there is a bug with my patch: I should display this message only when I really create the gallery.

Hetta’s picture

My apologies, it did indeed create the folders it said it did - I'd forgotten one part of my gallery structure, on making folders in the import folder.

Tried again with the currently valid gallery structure on hard drive: everything works as advertised, including the correct "created gallery" message only on creating a new gallery.

It really is a lovely patch.

hover’s picture

Version: 6.x-1.x-dev » 5.x-2.x-dev

Hello, is it working with drupal 5.7?

David Stosik’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev

This doesn't work for Drupal 5.7, as it is a patch of Drupal 6 version of the module...
Maybe I will develop a 5.x version if it is needed for my patch to be commited.

David

financialgeek’s picture

I've been using this patch to import images in D6, works great! Thanks!

doc2@drupalfr.org’s picture

I don't think this is necessary for you to make a 5.x version of your patch in order for your patch to be commited...

... but it might definately be interesting for many existing drupal sites already running under the 5.x release.

drewish’s picture

Status: Reviewed & tested by the community » Needs work

looks pretty good (i'd suggest proper sentence capitalization and punctuation on the comments but i won't hold up a patch on that count), the only thing that needs work is that the hook_uninstall() implementation should delete the variables.

David Stosik’s picture

My patch doesn't set any variable. So I don't see what should I delete in hook_uninstall...

drewish’s picture

Status: Needs work » Reviewed & tested by the community

whoops, my bad mis-read that...

YesCT’s picture

is this in the alpha release?

David Stosik’s picture

Sadly, I don't think so...

YesCT’s picture

i applied the patch to the 6.x-1.x-dev 2008-Apr-18 release and it worked great for the small test I did. I mean really beautiful, I had jpgs in folders, in folders, etc and it created galleries and subgalleries corresponding to my directories. Just perfect! I really hope this gets in a release. It is a huge usability / newbie friendly feature!

gresda’s picture

Same comments, really good patch/addon !!

Thanks a lot

YesCT’s picture

Will this work with this http://drupal.org/node/103793 (naming of files/storing in the directory structure)?

YesCT’s picture

http://drupal.org/node/253631 seems to be related (the "hierarchical taxonomy mode, additionally sets the terms hierarchical relations to resemble the path structure" part).

David Stosik’s picture

Priority: Normal » Critical
Status: Reviewed & tested by the community » Needs review

Hello,
Here is a new version of my patch, applying to Image Import 6.x-1.x-dev. The only feature I added is to put a link to the gallery for message "Created gallery xxx", when import done.
The patch now applies to the file image_import.admin.inc (as code was migrated to this inc file).
As many people seem to be waiting for this feature, I put priority to critical.

Regards,
David

Edit: second time I can't upload a file to Drupal, so here is an external link: image_import_keep_tree.patch

David Stosik’s picture

Hello,
Any news?

David Stosik’s picture

Hello,
What's new?
Thanks,
David

David Stosik’s picture

Hello,
I would like to know if there's any chance my patch gets commited one day to image module. If yes, when could it be commited?

drewish’s picture

Status: Needs review » Needs work

i can't get to the patch. i'd like to see some other people testing out this patch.

Hetta’s picture

"file not found" in French on the patch site ... sto: you can't upload a file with the same name as one that already exists. I suggest you upload to drupal as image_import_keep_tree-225014_39.patch (where "39" is the number of the comment in the thread ...)

David Stosik’s picture

Sure, it can't patch anymore, as the module lived since my last patch upload. I will try to upate it when I have time. Concerning the "uploading a file with the same name" problem, I don't think it's my problem, as I use standard image method, and did not change the way it upload images.

Regards,
David

bluemoon99’s picture

Does the patch working fine with the version "6.x-1.x-dev 2009-Mar-23"?

Or what version should i use to apply the patch?

i am going to develop a photo site with several thousands images, it's painful if all the images are store into one folder..

Any help would be appreaciated!

DoctorWho’s picture

The latest uploaded patch is not available any more. Could someone please upload the latest patch again?

jhofer’s picture

Any chance this will be updated David? This is a crucial patch for those of use dealing with complicated gallery structures. Thanks for your work and I hope you see this through until it is committed. (How do we help you get this committed by the way?)

rsommer’s picture

I'd like to have this patch updated too. Have to import 2700 Images at once. The Images are well structured in a folder hierarchy. But uploading every folder by itself would be horrible. I've searched about hours but found no solution for image_import 6.x-1.0-alpha5. And I would really like to use image module because everything else is working like a charm with this module.
Thanks in advance for every helping hint.

joachim’s picture

> (How do we help you get this committed by the way?)

Image 1.0 is getting released at DrupalCon, whatever state things are in. For this patch to go in, it needs to be rerolled against CVS HEAD and tested by at least one other person.
Anyone can reroll the patch against the current CVS HEAD. (well anyone with basic coding skills ;)

David Stosik’s picture

Maybe I will be able to work on it before DrupalCon next week.
I will attend some conferences at the DrupalCon, maybe I'll be able to attend to the image module code sprint. ;)

First I'll have to find the latest patch I provided. ;)

joachim’s picture

Cool!
I'll keep this thread updated: http://paris2009.drupalcon.org/forum/image-10

David Stosik’s picture

I did not find the last version of my patch, so I'll have to re-roll an older one, that's not a big issue...
But first, I will have to wait for a fix for the issue #450850: HTML code when try to import images... ;)

David Stosik’s picture

Status: Needs work » Needs review
FileSize
17.08 KB

Here it is. :)

joachim’s picture

Status: Needs review » Fixed

Works perfectly!
Committed.

Thanks for your perseverance with this :)

Couple of minor things to note for future patches -- please roll them against the main module root (ie the image folder), and also avoid tweaks like the fixes to '!edit-link' on line 77. The latter are good, but should be in a separate issue so the patch is easier to read and understand. (Read webchick's post

David Stosik’s picture

Thanks !
How did the sprint go ?
Will there be a sprint on saturday ?

joachim’s picture

I didn't find anyone else for sprinting yesterday and was hampered by lack of wifi.
The plan is to sprint saturday if there are people around -- Sat morning probably, watch the forum post and IRC.

David Stosik’s picture

\o/
Great ! I was not there yesterday (too much work), but will probably be there on Saturday. :)

joachim’s picture

Cool.
I'm joachim on IRC. Currently in the aegir session if you want to come say hello today.
Also -- sun, quicksketch, and I will be figuring stuff out after the imagefield session tomorrow.

asb’s picture

Hi,

this addition is a very nice add-on to the image_import sub-module; I tried it on a quite fresh D6 site and imported a bunch (~ 1000) of images. After clicking through a sequence of import screens for about an hour, all the image nodes were created properly - very nicely done; there are not many working alternatives for bulk uploading images to a Drupal site at the moment, so this is a huge improvement!

But (sorry ;) - I couldn't access any of the newly created galleries or sub-galleries: Access denied. You have no access permission for this page. I'm User #1 and already tried to rebuild the Content access permissions at ./admin/content/node-settings without success. Basically nobody seems to be able to access the newly created galleries/taxonomy terms.

Does anyone else experience this error with the recent image_module, or is this just another issue personally crafted fo me?

Thanks for this well done feature & greetings,
-asb

David Stosik’s picture

Are you using other modules, such as Taxonomy Access Control ?
Last time I tried on a fresh install, it worked very well, and I was able to access the galleries...

asb’s picture

> Are you using other modules, such as Taxonomy Access Control ?

Nope. But after some digging I think your patch is "not guilty", all older galleries seem to have become inaccessible, too (taxonomy term pages are displayed, image gallery pages based on taxonomy terms are inaccessible). Needs further investigation and requires probably a separate issue...

Edit: #571504: Galleries not working anymore

Greetings, -asb

Status: Fixed » Closed (fixed)

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