Bulk import images as nodes? Better yet... bulk import images as ubercart PRODUCT nodes!

Events happening in the community are now at Drupal community events on www.drupal.org.
jnicola's picture

Hey everyone, haven't posted in a bit! I've been to busy, but a recent injury freed up some time in my life. Horrible way to come onto free time, but it goes that way sometimes!

Anyways here's the backstory:

I notice at a lot of the open entry sports events I attend (sporting events where anyone can enter), photographers take a ton of pictures and sell them back to the participants. My girlfriend likes photography, and it seemed like a good way to help her earn some extra money while attending college. So, I offered to help her get setup online. The only pre-made places I found take huge commissions, and most just take everything and leave you nothing! No way was I going to stand for that, especially since I work in Drupal, only the awesomest open source CMS ever!

The problem:

Amongst Drupal's many shortcomings appears to be massive image importation. Now, you can use image Fupload, which is buggy and long unsupported and loses track of it's own steps. There is also the stock image import... which kind of works... except I can't use image cache nor CCK or anything fun, it's all handled separately. This all also doesn't really tie into selling the images either, and ESPECIALLY doesn't tie in to organizing them one bit either!

What I'd like to be able to do:

1- Set two parameters in advance for image importing, such as Taxonomy term (Event Name) and base price to use for the uploaded images ($2 an image)
2- Select an FTP Directory which has all the images in it already for import.
3- Click go, and have it process through all the images, pulling them into the ubercart "product" content type with all of the correct information.
4- Users can then purchase the full size original image for just $2

Anyone got any ideas or ways to make this work? Right now what I've been playing with gets me a portion of the way there and then just sort of falls apart. It also doesn't fall into the realm of user friendly by any shade of the imagination.

Thanks in advance,
Jesse Nicola

Comments

One option: plupload

effulgentsia's picture

If this is D6, then check out http://drupal.org/project/plupload. With it, you upload from your browser, not via an FTP location. It doesn't let you configure defaults for additional fields on the node type, but maybe you can configure those defaults directly on the node type first, and it will work? I'm not sure, but give it a shot.

For D7, you might want to check out http://drupal.org/sandbox/vingborg/1138512.

Feeds will do most of this...

dsayswhat's picture

Out of the box, Feeds will

  • import images into CCK FileFields (it downloads them for you, so your csv data might need to have a url for the image, then it'll put it into the right spot )
  • map into one or another content type - products, in your case
  • set taxonomy terms on your content

There's also a module for basic ubercart integration with feeds - http://drupal.org/project/uc_feeds. The documentation says you can map to price and weight...sounds like this might work for your needs...so the process will look something like this:

  1. Download and install the feeds and uc_feeds module. Documentation can be found at http://drupal.org/node/622696
  2. Set up a csv file, first row as column headers/field names
  3. Configure feeds to use the 'file fetcher' (allows you to upload data for import) and 'csv parser' and to process into product nodes.
  4. Map your csv fields to node fields, cck filefield, price, and taxonomy.
  5. Run the import.

Good luck...

Thanks Darren, only issue I

jnicola's picture

Thanks Darren, only issue I see is this requires a CSV document of all the files...

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

Here's my usual approach

inversed's picture

Probably a bunch of ways to do this without coding... It's easy to get a CSV of your files using a couple of steps. CSV files are actually very simple if you look inside them with a text editor, so no worries.

For example, you could just get a list of them using the command line and direct the output to a file. For example, in Windows, "dir /b > images.csv" will write out a list of files. If working on a Mac or Linux, use "ls -1 > images.csv" to list each file on it's own line. You could open the contents of this list in your spreadsheet editor and manipulate as needed. Using variations on this, you can output the full folder location also or use your spreadsheet editor to add a column of your own design.

What I end up doing is adding a column with the server accessible location, i.e "http://.../" in front of the filename and. I copy the contents of the spreadsheet into a text document and search and replace the tabs between the location and the filename, removing them. Then I save the file as a CSV (or whatever) and all done.

It's not that I'm incapable

jnicola's picture

It's not that I'm incapable of creating a CSS file, it's that this I'm trying to find a generic and easy to use method I can hand off to clients. Nothing about what you've said is easy for a client, 99% of which haven't ever seen a command line interface.

I suppose I could write some PHP code to dump out a CSV file of a directory, and fork it over to feeds... but I'm going for something user friendly here...

I'm now trying plupload with node gallery, which appears to be a pretty good solution. More on this to come...

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

@jnicola: Did you manage to

chalee's picture

@jnicola: Did you manage to complete the solution to this issue? I'm looking for a similar solution.

Not really unfortunately

jnicola's picture

Not really unfortunately :(

The real hangup I encountered was that all the imagecache images were to be generated only once an image was viewed... which makes sense from one side of the performance perspective (why generate something that may not be seen?) but on the other hand, when a user wants to visit a page with 20 images being processed down from a large size, it bogs down the server.

So, the current solution would require an ungodly robust server. This lead me to think about distributed computing, where I setup a local environment on my PC (with gobs of horsepower), run all the imagecache stuff there, and then I swap my local environment out with the remote environment. Essentially my PC does the heavy lifting, and the hosting does the delivery.

I never got past that though... and who knows what has developed since :(

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

Thanks for the quick reply

chalee's picture

Thanks for the quick reply and the explanation of your possible solutions. If I find a better solution I will post back here.

Batch?

bbinkovitz's picture

Is this something the batch API might be able to help with? http://drupal.org/node/180528

If the batch api could be

jnicola's picture

If the batch api could be used to run through all the image cache variations of all the images, yes it would work.

Currently imagecache doesn't render an image until a request for the image is made. So, when a user goes to a views page of 30 images, and all 30 have to be generated at once, and if the high quality originals are 8mb each, that's 240mb of images to process through... and needless to say it all stalls out and winds up causing rendering issues for the customer.

So yeah, batch api might be the way to fix this... but I'm not familiar enough with the batch API to resolve this issue.

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

Issue w/ Node Gallery view of Product

lohner's picture

I find it interesting that jnicola and I are following an identical approach to solve a similar problem.

jnicola how were you able to get the image from Product to be displayed on Gallery? No matter what I do I can only see the file name displayed in the teaser and nothing on the Gallery.

I have tried to just modify the default gallery relationship to point to product and when I do so I cannot get the image to display in the gallery.

Would you be able to provide guidance on this?

sorry if I have changed the direction of this thread but I just can't seem to find my answer and jnicola is working on practically the same thing as I.

Oh geeze, I worked on this...

jnicola's picture

Oh geeze, I worked on this... two and a half years ago! I gave up was it was a personal project, and instead focused on other work. This sort of functionality would be essential for a website selling photos! I understand generating photos on demand, but in some sites, it just won't work. it's also a metric crap ton of horsepower though...

Last I left off, I was conceptualizing handling this in an interesting fashion... you would upload everything to a local environment where processor power are cheap and plentiful. That would loop through all images, and check for the derivatives we need built (IE: Image styles). It would then generate all of them, and then it would rsync files off to remote upon completion

I know enough now about module dev that I could possibly take on this task... but it's a doozey of a task still. This would make one hell of a distribution though!

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

My issue, right now, isn't

lohner's picture

My issue, right now, isn't uploading massive amounts of photos. The issue I am currently having is that when I switch Gallery Item Content Type to anything other then the default the image will not display in the gallery.

It will display the Image Name and Author Submission information but NO image. Pointing the Item type back to the Gallery Item Content Type in the default rule allows it to work.

I have a straight up 7.32 drupal core with the most recent Node Gallery module. Seriously this is straight out of the box.

Any idea why I can't create a custom gallery/gallery item and have the item displayed on the gallery?

I am sure you are very busy but this NOOB would love a pointer or to at least know that I am not crazy. I have also posted on the node gallery issues board in hopes to a response there. I AM STUCK and frankly really frustrated.

-thanks

There's a LOT of reasons that

jnicola's picture

There's a LOT of reasons that could be going on. What I would first do is check the source code (via inspector ideally) to see if it is even attempting to output an image there. If so, grab the URL and navigate to it directly. If the image by itself loads, reload the original page.

Report your findings back. Also tell me a bit about the environment you are working in (Shared hosting, local environment, WAMP, etc etc)

Jesse Nicola -- Shredical six different ways to Sunday! -- My Portfolio

Portland (Oregon)

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: