[html-formfu] Formfu inflator error

Carl Franks fireartist at gmail.com
Tue Mar 17 21:59:33 GMT 2009


2009/3/17 mohanprasad <mohan at thebizmo.com>:
>
> Hello everybody,
> i have written a form with the following elements for testing inflator
> feature in formfu. But when i tried to upload the image , form submittion is
> failing, i am getting the "Error opening image file" error
>
> yml form is as follows.
>
> elements:
>    - type: File
>      name: image
>      label: Upload image
>      attributes:
>        title: Browse and upload image
>      inflators:
>        - type: Imager
>    - type: Submit
>      name: submit
>      value: Upload
>
> Controller actions for handling it is as follows.
> # start of controller action
> sub image :Chained('base') Args('0') FormConfig {
>    my ($self, $c) = @_;
>    my $form = $c->stash->{form};
>
>    if ($form->submitted_and_valid) {
>        $c->log->info("form submitted and valid");
>        my $image = $form->param_value('image');
>        # do some stuff here
>        $c->stash->{success_msg} = "Your new avatar uploaded successfully";
>        $c->stash->{template} = 'image_success.tt';
>    }else{
>        $c->log->info('form submission failed');
>        $c->stash->{template} = 'image.tt';
>    }
> }
> # end of controller action
>
> Form submission is always failing for any type of image.
> Could anybody let me know where i am doing wrong?

Download the "Imager" distribution from cpan, run the Makefile.PL and
check its output.
It'll list whether or not it's found the libraries for each file type.
I suspect either they're not installed, or it's not finding them.

On fedora, it's just a matter of:
    yum install giflib-devel libpjeg-devel libpng-devel libtiff-devel
(plus any other libraries you want)
And then rebuilding and installing Imager.pm

Carl



More information about the HTML-FormFu mailing list