Whatever message this page gives is out now! Go check it out!
ImageGetBlob(source) |
Parameter | Description |
source | Required. The ColdFusion image on which this operation is performed. |
<!--- This example shows how to add a ColdFusion image to a database. --->
<!--- Create ColdFusion image from a an existing JPEG file. --->
<cfimage source="aiden01.jpg" name="myImage">
<!--- Use the cfquery tag to insert the ColdFusion image as a BLOB in the database. --->
<cfquery name="InsertBlobImage" datasource="myBlobData" >
INSERT into EMPLOYEES (FirstName,LastName,Photo)
VALUES ('Aiden','Quinn',<cfqueryparam value="#ImageGetBlob(myImage)#" cfsqltype='cf_sql_blob'>)
</cfquery><!--- Use the cfquery tag to retrieve all employee photos and employee IDs from a database. --->
<cfquery name= "GetBLOBs" datasource= "myBlobData">
SELECT EMLPOYEEID, PHOTO FROM Employees
</cfquery>
<!--- Use the ImageNew function to create a ColdFusion image from the BLOB data that was retrieved from the database. --->
<cfset myImage = ImageNew(#GetBLOBs.PHOTO#)>
<!--- Create thumbnail versions of the images by resizing them to a 100x100-pixel image, while maintaining the aspect ratio of the
source image. --->
<cfset ImageScaleToFit(myImage,100,"")>
<!--- Convert the images to JPEG format and save them to files in the thumbnails subdirectory, using the employee ID as the filename. --->
<cfimage source="#myImage#" action-"write" destination="images/thumbnails/#GetBLOBs.EMPLOYEID#.jpg">