It would be nice to be able to overwrite the amount of images that are generated by pdf to image.
Example: The image field is also used as plain image field with insert functionality, but the first image is used for the teaser.

In this case the image field can hold multiple images. But only one PDF image is needed.
The supplied patch adds this functionality.

CommentFileSizeAuthor
pdf_to_image-add_count_hook-1.patch1.36 KBmvdve

Comments

dman’s picture

Normally I'm in favour of hooks everywhere, but I don't feel that this particular feature would be implemented more than once ever - in this form anyway.
If this feature request were to be supported, it should also be usable by folk without them having to write their own module hook just to trigger it.

If there were to be an alter hook called at that point, then I think it would make sense that *all* the relevant $params that had been prepared for the function call should be alterable. One hook that ONLY lets you change the count (and not, for example, extra_args) is self-limiting.

The current behaviour is a simplification to keep the UI light and lazy : if you set a fixed value using the existing field cardinality UI, then pdf_to_imagefield respects that.
That needed no extra explanation, as it generally intuitively works for most cases. Though it's really using the existing option for a purpose it was never intended for.

If we wanted to go beyond that and really define the number, then the thing to do is expose the additional option in the field UI settings. If you want the number of images to be generated to be (1) in an (unlimited) target field ... then it's time to extend the settings and make that a separate, visible, configurable option.

I still think the automatic behaviour should remain the default unless over-ridden explicitly, but we can add a new value for folk to use (or ignore) that provides this function.

Even then, I dunno how useful the whole approach is, maybe there is a broader way of thinking about it...

hitchshock’s picture

Status: Needs review » Closed (outdated)

We stopped supporting the D7 version, so the ticket will be closed, but thanks to everyone who was working on the ticket!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.