这是一个奇怪的 - 我有'几乎'相同的代码在2页上,它可以在一个,但不是另一个。令人难以置信的无用错误消息“S3错误消息”。并没有说明我在哪里出错。ColdFusion ImageWrite到亚马逊S3
下面的代码在两页上都是相同的 - 这两页之间的唯一区别(非常轻微)是imgLink的生成方式 - 在工作页面上从单一来源(XML提要)和cfset获取,在没有工作的页面上imgLink最初设置为'none',然后检查多个源直到它找到一个 - 它仍然以cfset相同的方式,并且我有一个cfif来确保它在处理之前是有效的。但是 - 我也尝试对源代码进行硬编码(即粘贴通常位于imgLink cfset中的值),但仍然失败。
我已经调整了这种方式,我可能会想,在最后一天,没有成功。所以,我想我正在寻找什么我应该看看,可能会导致它失败的指针。
返回完整的错误是 -
进行文件操作时发生错误创建文件S3://mybucket/1577-67BC4EF7-1B21-866F-32E95DF67F3336C6-f.jpg。 此异常的原因是:org.apache.commons.vfs.FileSystemException:未知消息代码..
而且我的代码;“S3错误信息。”
<cfscript>
this.name ="Object Operations";
this.s3.accessKeyId = "accessKey";
this.s3.awsSecretKey = "secretKey";
this.s3.defaultLocation="EU";
</cfscript>
<!--- CFImage Stuff --->
<!--- S3 Permissions --->
<cfset perms = [{group="all", permission="read"}]>
<!--- Create the Images ---->
<cfset imageuuid = '#CreateUUID()#'>
<cfset imagefull = '#getid.id#-#imageuuid#-f.jpg'>
<cfset imagemain = '#getid.id#-#imageuuid#-m.jpg'>
<cfset imagethumb = '#getid.id#-#imageuuid#-t.jpg'>
<cfimage action="read" name="img1" source="#imgLink#">
<!--- Create the full size image 505 x N --->
<cfif img1.height GT img1.width>
<cfif img1.width GTE 505>
<cfset ImageResize(img1,'505','')>
</cfif>
<cfelseif img1.width GT img1.height>
<cfif img1.width GTE 505>
<cfset ImageResize(img1, '505','')>
</cfif>
</cfif>
<cfset ImageWrite(img1, "s3://mybucket/#imagefull#")>
<cfset StoreSetACL("s3://mybucket/#imagefull#","#perms#")>
<!--- Create the main size image 251 x N --->
<cfif img1.height GT img1.width>
<cfif img1.width GTE 251>
<cfset ImageResize(img1,'251','')>
</cfif>
<cfelseif img1.width GT img1.height>
<cfif img1.width GTE 251>
<cfset ImageResize(img1, '251','')>
</cfif>
</cfif>
<cfset ImageWrite(img1, "s3://mybucket/#imagemain#")>
<cfset StoreSetACL("s3://mybucket/#imagemain#","#perms#")>
<!--- Create the thumbnail 52 x 52 --->
<!--- resize image to 52 pixels tall if width is greater then height --->
<cfif img1.height GT img1.width>
<cfset ImageResize(img1,'52','')>
<cfset fromX = img1.Height/2 - 26>
<cfset ImageCrop(img1,0,fromX,52,52)>
<!--- resize image to 75 pixels wide if height is greater then width --->
<cfelseif img1.width GT img1.height>
<cfset ImageResize(img1,'','52')>
<cfset fromY = img1.Width/2 - 26>
<cfset ImageCrop(img1,fromY,0,52,52)>
<cfelse>
<cfset ImageResize(img1,'','52')>
<cfset ImageCrop(img1,0,0,52,52)>
</cfif>
<cfset ImageWrite(img1, "s3://mybucket/#imagethumb#")>
<cfset StoreSetACL("s3://mybucket/#imagethumb#","#perms#")>
这是否发生在任何文件或只是特定的图像?我会尝试隔离问题,例如首先在磁盘上写入映像(或者更好地在ram fs中),然后将其作为文件复制到存储桶中。 – Sergii 2012-02-02 11:56:32
@Sergii - 它与所有文件。然而,我刚才发现问题出在哪里 - '没有工作'版本的文件驻留在一个自己的Application.cfc文件夹中。我显然还不能回答我自己的问题,但我会在后面详细介绍发生的事情,为将来寻找其他人的利益。 – Lee 2012-02-02 12:22:13