This commit is contained in:
msyu
2024-10-23 11:17:42 +03:00
commit ab5c944862
380 changed files with 55823 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
RewriteEngine On
#if we've already been rewritten to use index.cfm/* format, don't make a circular request
RewriteRule ^(index\.cfm[/.]?+|images/.*) - [L]
RewriteRule ^(.*)$ index.cfm/$1
+19
View File
@@ -0,0 +1,19 @@
<cfcomponent extends="taffy.core.api">
<cfscript>
this.name = hash(getCurrentTemplatePath());
variables.framework = {};
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.serializer = "taffy.core.nativeJsonSerializer";
function onApplicationStart(){
application.lastReset = now();
return super.onApplicationStart();
}
</cfscript>
</cfcomponent>
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+6
View File
@@ -0,0 +1,6 @@
<!---
DO NOT DELETE THIS FILE
===============================
This file is necessary for Taffy to work, but should be blank.
All requests funnel through it, but are handled by framework internal functionality.
--->
@@ -0,0 +1,13 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/pdf/mew">
<cffunction name="get">
<cfset var local = structNew() />
<cfdocument format="PDF" name="local.pdf">
<h1>Mew mew mew mew</h1>
<img src="/taffy/examples/api_img/images/Kitten_cups.jpg"/><br/>
<img src="/taffy/examples/api_img/images/PETA_sea_kitten.jpg" />
</cfdocument>
<cfreturn streamBinary(local.pdf).withStatus(200).withMime("application/pdf") />
</cffunction>
</cfcomponent>
@@ -0,0 +1,12 @@
<cfcomponent extends="Taffy.core.resource" taffy_uri="/kitten/random">
<cfdirectory action="list" directory="#expandPath('./images')#" name="variables.images" />
<cfset variables.fileTypes = { jpg="image/jpeg", jpeg="image/jpeg", gif="image/gif", png="image/png", bmp="image/bmp" } />
<cffunction name="get" access="public" output="false">
<cfset var row = randRange(1,variables.images.recordCount) />
<cfset var file = variables.images.directory[row] & "/" & variables.images.name[row] />
<cfreturn streamFile(file).withStatus(200).withMime(fileTypes[listLast(variables.images.name[row], '.')]) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,41 @@
<cfcomponent extends="Taffy.core.resource" taffy_uri="/placekitten/{width}/{height}">
<cfdirectory action="list" directory="#expandPath('./images')#" name="variables.images" />
<cfset variables.fileTypes = { jpg="image/jpeg", jpeg="image/jpeg", gif="image/gif", png="image/png", bmp="image/bmp" } />
<cffunction name="get" access="public" output="false">
<cfargument name="width" />
<cfargument name="height" />
<cfset var img = '' />
<!--- pick a file --->
<cfset var row = randRange(1,variables.images.recordCount) />
<cfset var file = variables.images.directory[row] & "/" & variables.images.name[row] />
<cfset var fileType = listLast(variables.images.name[row], '.') />
<!--- resize it on the fly to fit the requested dimensions, scaling as necessary --->
<cfif arguments.width gt arguments.height>
<cfimage action="resize" source="#file#" name="img" height="" width="#arguments.width#" />
<cfset imageCrop(img, 0, 0, arguments.width, arguments.height) />
<cfelseif arguments.width lt arguments.height>
<cfimage action="resize" source="#file#" name="img" height="#arguments.height#" width="" />
<cfset imageCrop(img, 0, 0, arguments.width, arguments.height) />
<cfelse>
<cfimage action="read" name="img" source="#file#" />
<cfset w = imageGetWidth(img) />
<cfset h = imageGetHeight(img) />
<cfif w gt h>
<cfimage action="resize" source="#file#" name="img" height="#arguments.height#" width="" />
<cfelseif h gt w>
<cfimage action="resize" source="#file#" name="img" height="" width="#arguments.width#" />
<cfelse>
<cfimage action="resize" source="#file#" name="img" height="#arguments.height#" width="#arguments.width#" />
</cfif>
<cfset imageCrop(img, 0, 0, arguments.width, arguments.height) />
</cfif>
<cfreturn streamImage(img).withStatus(200).withMime(fileTypes[fileType]) />
</cffunction>
</cfcomponent>