Issues when uploading images using FTP as the CDN

I’m using FarCry 7.2.9, when I set the CDN type to FTP, I’m running into some issues when uploading images:

  • Auto-generated sizes are not saved to the CDN. I don’t think FarCry is resizing the images.

  • For the thumbnail size, with auto-generate turned on, the image filepath is not saved to the database, even if I opt to upload my own image. This issue seems to be isolated to the thumgnail size. When auto-generate is turned on for the MidSize Image field, the filepath does get saved and the image is uploaded to the CDN, but it’s not re-sized.

Has anyone run into this issue?

I haven’t had a need for the FTP CDN for a long time, practically since I
wrote it, so it’s possible that bugs have been introduced as the rest of
FarCry has been been updated. Have any exceptions been logged?

Blair

I did a fair bit of work to try to improve the performance of the FTP support that we have in the CDN libs, and around compatibility issues between ACF and Lucee (Railo), so it should still be in a good working state. I didn’t have any issues with image crops not being generated or saved to the DB.

However I do find that to have a good user experience you need a very low latency (e.g. sub 10 milliseconds) and good bandwidth (100mbit/s) to your FTP server. If FTP requests are taking upwards of one second or uploads are slow you may find that waiting for crops and/or editing records that use images are just too slow, in which case I’d be looking at moving to S3 (if possible).

If an image path string isn’t being saved into a column in your database perhaps it could be that the string is too long for the column? Are you uploading an image with a very long filename? If not, hopefully you can look in the ACF/Lucee logs directory to find some more information, either exception.log or fourq.log might have something related.

After looking through the code and many image uploads later…turns out the issue is with the cfhttp call in the ioFileExists function of /farcry/packages/cdn/ftp.cfc :

<cfhttp url="http:#getURLPath(config=arguments.config,file=arguments.file)#" method="HEAD" /> 

This returns a 404, so the GenerateImage function doesn’t auto-generate the images. However, the source image does get copied into the Thumbnail directory. The only way I’ve been able to get the auto-generated images created is to make a call before that line of code above executes. I’m using Limelight as the CDN. Maybe Limelight needs the file content to be called first before it’ll return header information? I also tried changing the method to “get” in ftp.cfc, but that still returned a 404.

I made a project copy of image.cfc and added the following within the clause that runs after the source image is copied into the thumbnail folder in the “ImageAutoGenerateBeforeSave” function:

<cfif isdefined("stResult.value") and len(stResult.value)>
<cfset thisURL = application.fc.lib.cdn.getLocation('images').urlPathPrefix & stResult.value> 
<cfhttp url="http:#thisURL#" method="get">

It seems to be working, though, I wonder if there’s a better way to handle this.