You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Issa Mbodji <is...@yahoo.com> on 2003/07/22 00:53:49 UTC

[users@httpd] Help with MIME-type

Hello:

I am running Apache on WinXP Pro and I have a form
created with perl with 2 fields only. One is where the
file to be uploaded goes and the other one is for
comments and I am trying to load these images into a
mysql db. Now when I select a .gif or .jpeg file, put
some comments and click on submit, here is the message
I am geting and do not seem to understand. Could
someone please tell what I am doing wrong:

Error: Can't convert image data: Warning 330: no magic
configuration file found (magic.mgk) [No such file or
directory]

Thanks.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with MIME-type

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 21 Jul 2003, Issa Mbodji wrote:

> my $img = new Image::Magick;

>    $err = $img->BlobToImage ($full);
>    error ("Can't convert image data: $err") if $err;

> > On Mon, 21 Jul 2003, Issa Mbodji wrote:
> > > Error: Can't convert image data: Warning 330: no
> > magic
> > > configuration file found (magic.mgk) [No such file
> > or
> > > directory]

And there is the code generating the error.  So you need to look at the
docs for Image::Magic and see why it is failing.  I have no idea, since
I've never used this.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with MIME-type

Posted by Issa Mbodji <is...@yahoo.com>.
Thanks for getting back to me. I am using a perl
program that process the form. Is it what you are
referring too?  Here it is:

sub display_upload_form
{
   print start_multipart_form (-action => url ()),
           "Image file: ", br (),
           filefield (-name => "image", -size => 60),
           br (),
           "Descriptive name for image: ", br (),
           textfield (-name => "name",
                       -value => "",
                       -override => 1,
                       -size => 60),
           br (), br (),
           submit (-name => "choice", -value =>
"Submit"),
           end_form ();
}




sub process_form
{
my $name = param ("name");                # image name
my $image = param ("image");            # image file
my @errors = ();
my $dbh;
my $mime_type;
my ($full, $thumb);
my $serve_url;

   $image = "" unless defined ($image);# convert undef
to empty string
 
   # check for required fields
   push (@errors, "Please supply an image name") if
$name eq "";
   push (@errors, "Please specify an image file") if
$image eq "";
   if (@errors)
   {
       print p ("The following errors occurred:");
       print ul (li (\@errors));
       print p ("Please click your Browser's Back
button to\n"
               . "return to the previous page and
correct the problem.");
       return;
   }

   # Form was okay; get image type and contents and
create new record.
   # Use REPLACE to clobber any old image with the
same name.

   $mime_type = uploadInfo ($image)->{'Content-Type'};
   ($full, $thumb) = read_image_file ($image);
     #connect the db
   #insert the record
   $dbh->disconnect ();

   # Image was stored into database successfully. 
Present confirmation
   # page that displays both the full size and
thumbnail images.

   print p ("The image upload was successful.");
            }



sub read_image_file
{
my $fh = shift;                # filename/file handle
my $img = new Image::Magick;
my ($full, $thumb);
my $err;

   # read full-size image directly from upload file
   (read ($fh, $full, -s $fh) == -s $fh)
       or error ("Can't read image file: $!");
   # produce thumbnail from full-size image
   $err = $img->BlobToImage ($full);
   error ("Can't convert image data: $err") if $err;
   $err = $img->Scale (geometry => "64x64");
   error ("Can't scale image file: $err") if $err;
   $thumb = $img->ImageToBlob ();
   return ($full, $thumb);
}


{
my $msg = shift;

   print p (escapeHTML ("Error: $msg")), end_html ();
   exit (0);
}

--- Joshua Slive <jo...@slive.ca> wrote:
> 
> 
> On Mon, 21 Jul 2003, Issa Mbodji wrote:
> > Error: Can't convert image data: Warning 330: no
> magic
> > configuration file found (magic.mgk) [No such file
> or
> > directory]
> 
> This is almost certainly an error from whatever
> program you are using to
> handle the file upload.  But since I have no idea
> what this program is,
> there is no way to help.
> 
> Joshua.
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 


=====
Mame Issa Mbodji 
3201 Weeping Willow Ct # 33 
Silver Spring, MD , 20906 
Tel. (301) 603-0847 
e-mail: issambodji@yahoo.com

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with MIME-type

Posted by Joshua Slive <jo...@slive.ca>.

On Mon, 21 Jul 2003, Issa Mbodji wrote:
> Error: Can't convert image data: Warning 330: no magic
> configuration file found (magic.mgk) [No such file or
> directory]

This is almost certainly an error from whatever program you are using to
handle the file upload.  But since I have no idea what this program is,
there is no way to help.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org