11component {
22
3- variables .version = " 2.1.3" ;
3+ variables .version = " 2.1.3-develop" ;
4+ variables .isACF = ( server .coldfusion .productname IS " ColdFusion Server" );
5+ variables .isLucee = ( server .coldfusion .productname IS " Lucee" );
46
57 function init (
68 required array resolutions // the resolution break -points to use (screen widths , in pixels , any order you like )
@@ -168,8 +170,8 @@ component{
168170 }
169171
170172 private void function checkCachedImageIsNotLargerThanSource ( required string cachedFilePath , required string sourceFilePath ){
171- cachedFileSize = GetFileInfo ( cachedFilePath ).size ;
172- sourceFileSize = GetFileInfo ( sourceFilePath ).size ;
173+ cachedFileSize = _GetFileInfo ( cachedFilePath ).size ;
174+ sourceFileSize = _GetFileInfo ( sourceFilePath ).size ;
173175 if ( cachedFileSize GT sourceFileSize ){
174176 _log ( " AI: Scaled image is #( cachedFileSize - sourceFileSize ) # bytes larger than the original. Copying original instead." );
175177 FileCopy ( sourceFilePath , cachedFilePath );
@@ -306,9 +308,9 @@ component{
306308 // This check is expensive: disabled by default, but use if images change frequently and you are not using deleteCachedCopies() when performing updates
307309 private boolean function fileHasBeenUpdated ( required string sourceFilePath , required string cachedFilePath ){
308310 // get last modified of cached file
309- var cacheDate = GetFileInfo ( cachedFilePath ).lastModified ;
311+ var cacheDate = _GetFileInfo ( cachedFilePath ).lastModified ;
310312 // get last modified of original
311- var sourceDate = GetFileInfo ( sourceFilePath ).lastModified ;
313+ var sourceDate = _GetFileInfo ( sourceFilePath ).lastModified ;
312314 _log ( " AI: Checking for source updates: Cached file modified: #cacheDate #, source file modified: #sourceDate #" );
313315 return ( cacheDate LT sourceDate );
314316 }
@@ -336,7 +338,7 @@ component{
336338 cfheader ( name : " Content-type" , value : mimeType );
337339 if ( IsNumeric ( browserCacheSeconds ) )
338340 cfheader ( name : " Cache-Control" , value : " private,max-age=#browserCacheSeconds #" );
339- var fileInfo = GetFileInfo ( filepath );
341+ var fileInfo = _GetFileInfo ( filepath );
340342 cfheader ( name : " Content-Length" , value : fileInfo .size );
341343 cfcontent ( file : filepath , type : mimeType );
342344 abort ;
@@ -346,4 +348,13 @@ component{
346348 cfcookie ( name : " resolution" , value : " deleted" , expires : " now" ); // Change value to make testable
347349 }
348350
351+ private struct function _GetFileInfo ( required string path ){
352+ if ( ! isLucee )
353+ return GetFileInfo ( arguments .path );
354+ var result = FileInfo ( arguments .path );
355+ // support GetFileInfo().lastmodified
356+ result .lastmodified = result .dateLastModified ;
357+ return result ;
358+ }
359+
349360}
0 commit comments