Re: CDN changes breaking image generation?

Jeff Coughlin <[email protected]>
Newsgroups gmane.comp.cms.farcry.devel
Message-ID <-325672048892056468@unknownmsgid>
Yeah, that's the other thing I was thinking about. Might have to
rewrite/update that UDF.

--
Jeff Coughlin

On Aug 30, 2013, at 15:36, Sean Coyne <[email protected]> wrote:

Jeff I found it using your imageRegenerateFromSource() UDF.  I made the
required changes on MHPC not on MHS yet though.  Want to test on Windows
first.

On Friday, August 30, 2013 3:31:13 PM UTC-4, Jeff Coughlin wrote:
>
> Ouch. Hmm... I'll have to think about it. I think it might break something
> else to (unrelated).
>
> --
> Jeff Coughlin
>
> On Aug 30, 2013, at 15:07, Sean Coyne <[email protected] <javascript:>>
> wrote:
>
> We had some image regeneration scripts and when we changed over to FarCry
> 6.3 recently they stopped working properly.
>
> The change seems to be related to the CDN stuff.
>
> We were calling generateImage() from the Image formtool and passing the
> source and destination arguments as FULL disk paths.
>
> <cffunction name="GenerateImage" access="public" output="false" returntype
> ="struct">
>  <cfargument name="source" type="string" required="true" hint="The
> absolute path where the image that is being used to generate this new image
> is located." />
>  <cfargument name="destination" type="string" required="false" default=""
> hint="The absolute path where the image will be stored." />
>
> Now, when we do this, the CDN transforms the path by prepending the FULL
> disk path to the webroot.  So if we pass in
> /sites/farcry/projects/projectname/www/images/someType/imgTeaser/somefile.jpg
> the CDN stuff turns this into
>
>
> /sites/farcry/projects/projectname/www/sites/farcry/projects/projectname/www/images/someType/imgTeaser/somefile.jpg
>
> when checking if the file exists:
>
> <cfif not application.fc.lib.cdn.ioFileExists(location="images",file=
> arguments.source)>
>  <cfset stResult.bSuccess = False />
>  <cfset stResult.message = "File doesn't exist" />
>  <cfreturn stResult />
> </cfif>
>
> which calls this in the local CDN component:
>
> <cffunction name="ioFileExists" returntype="boolean" access="public"
> output="false" hint="Checks that a specified path exists">
>  <cfargument name="config" type="struct" required="true" />
>  <cfargument name="file" type="string" required="true" />
>
>  <cfreturn fileexists(getFullPath(config=
> arguments.config,file=arguments.file)) />
>  </cffunction>
>
> leading to this culprit:
>
> <cffunction name="getFullPath" output="false" access="public" returntype=
> "string" hint="Returns full internal path. Works for files and
> directories.">
>  <cfargument name="config" type="struct" required="true" />
>  <cfargument name="file" type="string" required="true" />
>
>  <cfset var fullpath = "" />
>
>  <cfif left(arguments.file,1) eq "/">
>  <cfset fullpath = arguments.config.fullpath & arguments.file />
>  <cfelse>
>  <cfset fullpath = arguments.config.fullpath & "/" & arguments.file />
>  </cfif>
>
>  <cfreturn fullpath />
>  </cffunction>
>
>
> So, shouldn't getFullPath first check to make sure that the "file" passed
> in isn't ALREADY the full path??
>
> In our case ioFileExists was returning false even though the file does
> exist because it was messing up the path.
>
> I have fixed our issue by only passing in webroot relative paths instead
> of the full disk path but this is a backwards compatibility issue for
> people who are manually calling GenerateImage()
>
> Thoughts?
>
> Sean
>
> --
> You received this message cos you are subscribed to "farcry-dev" Google
> group.
> To post, email: farcr...-/[email protected] <javascript:>
> To unsubscribe, email: farcry-dev+...-/[email protected] <javascript:>
> For more options: http://groups.google.com/group/farcry-dev
> --------------------------------
> Follow us on Twitter: http://twitter.com/farcry
> ---
> You received this message because you are subscribed to the Google Groups
> "farcry-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to farcry-dev+...-/[email protected] <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  --
You received this message cos you are subscribed to "farcry-dev" Google
group.
To post, email: farcry-dev-/[email protected]
To unsubscribe, email: farcry-dev+unsubscribe-/[email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
---
You received this message because you are subscribed to the Google Groups
"farcry-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev-/[email protected]
To unsubscribe, email: farcry-dev+unsubscribe-/[email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
--- 
You received this message because you are subscribed to the Google Groups "farcry-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/groups/opt_out.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.