1

私は実行Coldfuison8していて、画像ファイルのアップロードに問題があります。ユーザーが CMYK JPEG ファイルをアップロードしようとすることがよくあるようです。

アップロードは正常に機能し (エラーは発生しません)、isImageFileも返されますyesが、読み込まれた画像の色が歪んでいます。

これを行うだけで、間違った色の画像がサーバーに保存されます。

<cffile result="temp" 
        action="upload" 
        accept="image/jpeg,image/jpg" 
        filefield="Dateiname8" 
        destination="#variables.tempDirectory#" 
        nameconflict="overwrite" />

質問:エラーが発生しない
場合、Coldfusion は画像を正しく識別しています。isImageFile正しく表示するにはどうすればよいですか?

EDIT1:
つまり、ファイルは次のようになります。

ここに画像の説明を入力

そして、次のようになります。

ここに画像の説明を入力

EDIT2:

<cfhttp timeout="45" 
    throwonerror="no" 
    url="#LOCAL.testFilePath#" 
    method="get" 
    useragent="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"
    getasbinary="yes" 
    result="LOCAL.objGet">
<cfset LOCAL.objImage = ImageNew(LOCAL.objGet.FileContent)>
<cfset LOCAL.ext = ".png">
<cfset LOCAL.basePath = LOCAL.tempDirectory & "_base_" & LOCAL.file & LOCAL.ext>
<cfset imageWrite( LOCAL.objImage, LOCAL.basePath, ".99")>

fileそのため、ファイル名をとに分割しext、拡張子を.png. ファイルは作成されますが、ファイル サイズが 0 で、エラーがスローされます。

何がこれを引き起こしているのでしょうか?

EDIT3:これ
が私のスクリプトimageMagickです:

<cffile result="temp" action="upload" accept="image/jpeg,image/jpg" filefield="Dateiname8" destination="#variables.tempDirectory#" nameconflict="overwrite" />
<cfset variables.testFilePath = variables.tempDirectory & temp.serverFile>
<!--- imageMagick for CMYK uploads --->
<cftry>
    <cfimage action="info" source="#variables.testFilePath#" structname="cmyk" />
        <cfcatch type="any">
            <cftry>
                <cfexecute name="#expandpath("../tools/imageMagick/convert.exe")#" arguments="#variables.testFilePath# -strip -colorspace rgb -quality 100 #variables.testFilePath#" timeout="30" variable="msg" />
                <cfcatch>
                    <cfdump output="dump.txt" label="catch" var="type: #cfcatch.type#">
                    <cfdump output="dump.txt" label="catch" var="message: #cfcatch.message#">
                    <cfdump output="dump.txt" label="catch" var="detail: #cfcatch.detail#">
               </cfcatch>
            </cftry>
        </cfcatch>
    </cftry>
    <!--- Image can now be read --->
    <cfimage action="info" source="#variables.testFilePath#" structname="cmyk" />

ImageMagick は正常に実行されましたが、画像はまだ汚染されていました。次に、これを試しました:

<cfset variables.testFilePath = variables.tempDirectory & temp.serverFile>
<cfset variables.try = ImageRead( variables.testFilePath )>
<cfset ImageNegative( variables.try )>
<cfset ImageWrite( variables.try, variables.testFilePath, "0.99")>  

そして、それは正しいイメージを作成しました。唯一の問題は、元の画像で CMYK をチェックする方法です。その後、ImageMagick を使用する必要はありません。

EDIT4:
これは、画像をpngとして保存しようとしたときに発生する完全なエラーです

Detail: Ensure that the file is a vaild image file.
Message: ColdFusion was unable to create an image from the specified source file.
StackTrace: coldfusion.image.ImageReader$UnableToCreateImageException: ColdFusion was unable to create an image from the specified source file.
at coldfusion.image.ImageReader.readImage(ImageReader.java:114)
at coldfusion.image.Image.<init>(Image.java:236)
at coldfusion.runtime.CFPage.ImageRead(CFPage.java:5841)
at cfform_img_handler2ecfc1184626149$funcUPLOAD.runFunction(E:123)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:463)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:453)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:320)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2222)
at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:358)
at cfhs_herstellerprofil2ecfm1153584487._factor19(E:559)
at cfhs_herstellerprofil2ecfm1153584487._factor21(E:514)
at cfhs_herstellerprofil2ecfm1153584487._factor22(E:511)
at cfhs_herstellerprofil2ecfm1153584487._factor41(E:502)
at cfhs_herstellerprofil2ecfm1153584487.runPage(E:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:282)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:198)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
TagContext:  ...    
Type: Application

[coldfusion.image.ImageReader$UnableToCreateImageException のオブジェクト] クラス名: coldfusion.image.ImageReader$UnableToCreateImageException

親クラス: [coldfusion.image.ImageException のオブジェクト] クラス名: coldfusion.image.ImageException

Parent Class: [object of coldfusion.runtime.ApplicationException]
    Class Name: coldfusion.runtime.ApplicationException
    Parent Class: [object of coldfusion.runtime.NeoException]
        Class Name: coldfusion.runtime.NeoException
        Methods:  
            findAdvancedCFTarget(coldfusion.runtime.AdvancedCFException, java.lang.String[]) returns int 
            findCustomTarget(coldfusion.runtime.CustomException, java.lang.String[]) returns int 
            findThrowableTarget(java.lang.Throwable, java.lang.String[]) returns int 
            getDetail() returns java.lang.String 
            getLocalizedMessage() returns java.lang.String 
            getMessage() returns java.lang.String 
            getRootCause() returns java.lang.Throwable 
            getString(java.lang.Throwable, java.lang.String, java.util.Locale) returns java.lang.String 
            getType() returns java.lang.String 
            setLocale(java.util.Locale) returns void 
            unwrap(java.lang.Throwable) returns java.lang.Throwable
        Parent Class: [object of java.lang.RuntimeException]
            Class Name: java.lang.RuntimeException
            Parent Class: [object of java.lang.Exception]
                Class Name: java.lang.Exception
                Parent Class: [object of java.lang.Throwable]
                    Class Name: java.lang.Throwable
                    Methods:  
                        fillInStackTrace() returns java.lang.Throwable 
                        getCause() returns java.lang.Throwable 
                        getLocalizedMessage() returns java.lang.String 
                        getMessage() returns java.lang.String 
                        getStackTrace() returns java.lang.StackTraceElement[] 
                        initCause(java.lang.Throwable) returns java.lang.Throwable 
                        printStackTrace(java.io.PrintWriter) returns void 
                        printStackTrace(java.io.PrintStream) returns void 
                        printStackTrace() returns void 
                        setStackTrace(java.lang.StackTraceElement[]) returns void 
                        toString() returns java.lang.String 
4

0 に答える 0