First of all, this is a nice module! Thanks for sharing!
I use it in combination with ceaZine.
As I need to do work with larger PDF files, I needed an option to run the process in the background,
instead of having the user stare at the progress bar.
I found your comment in the code for an option to be able to choose the method of processing, so I implemented it.
Attached is a first patch that I'm using, although it's from the 7.x-3.3 and not from the dev version.
It's built with the standard Drupal Queue system, but it just works fine with Beanstalkd as well,
if you set Beanstalk as the class for this queue in the settings.php like this:
$conf['queue_class_p2i-queue'] = 'BeanstalkdQueue';
At the same time, I did a bit of housekeeping:
+ moved all field (widget/formatter) related functions to a field.inc file for better segmentation of the code
+ fixed some code formatting issues I found
As it runs in the background, I will need to be able to notify the user when it's done.
Thus, I'm going to implement a bit of rules integration as well. I'll create a separate issue for that I guess.
Let me know what you think,
Reszli
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pdf_to_imagefield.zip | 25.1 KB | reszli |
| pdf_to_image-queue-1.patch | 29.91 KB | reszli |
Comments
Comment #1
reszliWell, I just realized that what I did initially, is only moving the process to the background instead of running it in runtime.
But I did not split the task into pieces like the batch job did, so I might have issues with memory limit and timeout on larger files.
Here is another patch (well, it's more like a rewrite) of the current stable release
which contains a better implementation for Drupal Queue:
+ one job only processes one page of the pdf, then sets another job to process the following
+ once all the necessary pages are converted, the last job attached them to the entity
Other improvements:
+ the number of necessary pages to process is also optimized to use the max. cardinality of the target fields
+ yes, support for multiple target fields has also been added - partially from issue #2194217: Images from one pdf field to several image fields
+ more descriptive function names
+ more comments and code formatting
Still to come:
+ rules integration (to notify user when processing in the background is complete for ex.)
+ debug mode switch (to be able to turn off watchdog message on production for ex.)
+ I also realized, that this should all be done on the dev branch, so I will try to come up with an appropriate patch
Comment #2
hitchshockWe stopped supporting the D7 version, so the ticket will be closed, but thanks to everyone who was working on the ticket!