From 4a6ab48c16700894c266e4ee8b3eef0292b5801b Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 9 Aug 2013 01:29:35 +0000 Subject: [PATCH] --- MagickCore/identify.c | 6 +++++- MagickCore/magick.c | 48 +++++++++++++++++++++++++++++++++++-------- MagickCore/magick.h | 4 +++- coders/jpeg.c | 3 +++ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/MagickCore/identify.c b/MagickCore/identify.c index ce1c7b561..f2ee34628 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -381,11 +381,15 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, } magick_info=GetMagickInfo(image->magick,exception); if ((magick_info == (const MagickInfo *) NULL) || - (*GetMagickDescription(magick_info) == '\0')) + (GetMagickDescription(magick_info) == (const char *) NULL)) (void) FormatLocaleFile(file," Format: %s\n",image->magick); else (void) FormatLocaleFile(file," Format: %s (%s)\n",image->magick, GetMagickDescription(magick_info)); + if ((magick_info == (const MagickInfo *) NULL) || + (GetMagickMimeType(magick_info) != (const char *) NULL)) + (void) FormatLocaleFile(file," Mime type: %s\n",GetMagickMimeType( + magick_info); (void) FormatLocaleFile(file," Class: %s\n",CommandOptionToMnemonic( MagickClassOptions,(ssize_t) image->storage_class)); (void) FormatLocaleFile(file," Geometry: %.20gx%.20g%+.20g%+.20g\n",(double) diff --git a/MagickCore/magick.c b/MagickCore/magick.c index 3a24e6055..72246fd7d 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c @@ -649,6 +649,36 @@ MagickExport char **GetMagickList(const char *pattern, % % % % % % ++ G e t M a g i c k M i m e T y p e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetMagickMimeType() returns the magick mime type. +% +% The format of the GetMagickMimeType method is: +% +% const char *GetMagickMimeType(const MagickInfo *magick_info) +% +% A description of each parameter follows: +% +% o magick_info: The magick info. +% +*/ +MagickExport const char *GetMagickMimeType(const MagickInfo *magick_info) +{ + (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); + assert(magick_info != (MagickInfo *) NULL); + assert(magick_info->signature == MagickSignature); + return(magick_info->mime_type); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % G e t M a g i c k P r e c i s i o n % % % % % @@ -792,16 +822,18 @@ static void *DestroyMagickNode(void *magick_info) *p; p=(MagickInfo *) magick_info; - if (p->name != (char *) NULL) - p->name=DestroyString(p->name); - if (p->description != (char *) NULL) - p->description=DestroyString(p->description); - if (p->version != (char *) NULL) - p->version=DestroyString(p->version); - if (p->note != (char *) NULL) - p->note=DestroyString(p->note); if (p->module != (char *) NULL) p->module=DestroyString(p->module); + if (p->note != (char *) NULL) + p->note=DestroyString(p->note); + if (p->mime_type != (char *) NULL) + p->mime_type=DestroyString(p->mime_type); + if (p->version != (char *) NULL) + p->version=DestroyString(p->version); + if (p->description != (char *) NULL) + p->description=DestroyString(p->description); + if (p->name != (char *) NULL) + p->name=DestroyString(p->name); return(RelinquishMagickMemory(p)); } diff --git a/MagickCore/magick.h b/MagickCore/magick.h index dd6df5549..cc89fd217 100644 --- a/MagickCore/magick.h +++ b/MagickCore/magick.h @@ -51,6 +51,7 @@ typedef struct _MagickInfo *name, *description, *version, + *mime_type, *note, *module; @@ -93,7 +94,8 @@ extern MagickExport char **GetMagickList(const char *,size_t *,ExceptionInfo *); extern MagickExport const char - *GetMagickDescription(const MagickInfo *); + *GetMagickDescription(const MagickInfo *), + *GetMagickMimeType(const MagickInfo *); extern MagickExport DecodeImageHandler *GetImageDecoder(const MagickInfo *); diff --git a/coders/jpeg.c b/coders/jpeg.c index a9c61be48..d0314aea4 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -1491,6 +1491,7 @@ ModuleExport size_t RegisterJPEGImage(void) entry->description=ConstantString(description); if (*version != '\0') entry->version=ConstantString(version); + entry->mime_type=ConstantString("image/jpeg"); entry->module=ConstantString("JPEG"); (void) RegisterMagickInfo(entry); entry=SetMagickInfo("JPG"); @@ -1503,6 +1504,7 @@ ModuleExport size_t RegisterJPEGImage(void) entry->description=ConstantString(description); if (*version != '\0') entry->version=ConstantString(version); + entry->mime_type=ConstantString("image/jpeg"); entry->module=ConstantString("JPEG"); (void) RegisterMagickInfo(entry); entry=SetMagickInfo("PJPEG"); @@ -1515,6 +1517,7 @@ ModuleExport size_t RegisterJPEGImage(void) entry->description=ConstantString(description); if (*version != '\0') entry->version=ConstantString(version); + entry->mime_type=ConstantString("image/jpeg"); entry->module=ConstantString("JPEG"); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); -- 2.40.0