[development] File upload and convert

Earnie Boyd earnie at users.sourceforge.net
Tue Nov 27 16:33:36 UTC 2012


The OP cross posted to both support and development lists.  There is
an issue open for the description changes but I don't have the #
handy.  However, when in doubt use support and not development.

Earnie

On Tue, Nov 27, 2012 at 10:57 AM, Kevin Reynen <kreynen at gmail.com> wrote:
>
> @earnie Please stop telling developers discussing development to use the
> support list.  This list was started as "a list for Drupal developers"....
>
> http://web.archive.org/web/20110522011442/http://drupal.org/mailing-lists
>
> At some point the description of the list was changed to core development.
> Since core conversations rarely happen on this list, I'd like to see that
> changed back and limit suggestions to use the support list to questions
> about using Drupal or a  specific module.
>
> - Kevin
>
>
>
> On Tue, Nov 27, 2012 at 7:11 AM, Aaron Winborn <winborn at advomatic.com>
> wrote:
>>
>> You are looking for
>> http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_file_insert/7
>>
>>
>> On 11/27/2012 3:38 AM, Peter Droogmans wrote:
>>
>> Chris,
>>
>>
>>
>> You’ll need something custom, at leeast that’s how I solved it
>>
>>
>>
>> I added an extra file field so people could upload the file, using
>> hook_node_insert/hook_node_update I intercepted the upload, converted it,
>> and store the result in the other file field.
>>
>>
>>
>> You could do it using a custom file field widget as well, just extend the
>> current one (have a look at the image field widget, it extends the file
>> widget)
>>
>>
>>
>> Cheers,
>>
>> Peter
>>
>>
>>
>>
>>
>> From: development-bounces at drupal.org
>> [mailto:development-bounces at drupal.org] On Behalf Of Chris Miller
>> Sent: dinsdag 27 november 2012 1:33
>> To: development at drupal.org; support at drupal.org
>> Subject: [development] File upload and convert
>>
>>
>>
>> Hi Folks,
>>
>>
>>
>> I have a content type with TWO file fields, in which I will designate TWO
>> PDFs.  On upload completion I want to run something like: "exec(pdftk f1.pdf
>> background f2.pdf output f1.pdf)".  This will "brand" f1.pdf.
>>
>>
>>
>> I don't see any standard mechanism and so I'm not sure how to go about
>> this.  I have a general understanding, but that doesn't answer the question.
>> I am sure I don't want to intercept all possible uploads; just the uploads
>> from this specific content type.  So, can I define a file upload hook which
>> is scoped to this specific content type?  I haven't seen anything that makes
>> me believe I can.  Can I create a custom file field to use any time I need
>> to perform a conversion?  Can my custom file field "extend" the existing
>> file field, so I don't have to port improvements/bugfixes to my custom file
>> field version?
>>
>>
>>
>> So many questions...  (-:
>>
>>
>>
>> Thanks for the help,
>>
>>
>>
>> Chris.
>>
>>
>



-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the development mailing list