BASE64 ENCODE IMAGE()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to generate the base64 encoded contents of an object field image as an IMG tag and output it into the HTML5

Syntax

BASE64_ENCODE_IMAGE(<object-fieldname> [, <cWidth> [, <cHeight> [, <cCSSattribute>]]])

See Also

BASE64_DECODE(), BASE64_ENCODE(), BASE64_ENCODE_FILE(), STRCONV()

Description

The BASE64_ENCODE_IMAGE() function is used to generate the base64 encoded contents of an object field image as an IMG tag and output it into the HTML5. The optional <cWidth> and <cHeight> can be used to specify the image dimensions and <cCSSattribute> to add additional CSS attributes.

Example

<%@ Language=VFP %>
<html>
<head>
<style>
.pics
  {
  opacity:0.4;
  }
.pics:hover
  {
  opacity:1.0;
  }
</style>
</head>
<body>
<%
? "<table width='80%' align=center cellpadding=12>"
? "<tr>"
? "<td align=center colspan=2>"
? "<h1>Lianja example - image queries</h1>"
? '<p>Customize this to suit your own needs. This is a just an example.<p>'
? '<hr size="1px" color="lightgray"/>'
? "</td>"
? "</tr>"
? "<tr>"
? "<td colspan=2>"
? "<h3>Employees</h3>"
? "</td>"
? "</tr>"
 
// scan through the employees table
open database southwind
use employees
scan
	? "<tr>"
	? "<td>"
    ? "<a target='_blank' href='../odata/southwind/orders(" ;
        + etos(employeeid) ;
        + ",employeeid)'>"
    base64_encode_image(photo,"180px","200px","class='pics'")
	? '</a>'	
	? "</td>"
	? "<td>"
	? mtos(notes)
	? "</td>"
	? "<tr>"
	? '<td colspan="2">'
	? '<hr size="1px" color="lightgray"/>'
	? "</td>"
	? "</tr>"
	? "</tr>"
endscan
close data
 
? "<tr>"
? "<td align=center colspan=2>"
? "<p>Copyright © 2013 Lianja Inc. All rights reserved worldwide.</p>"
? "<h3><a href 'http://www.lianja.com'> www.lianja.com</a></h3>"
? "</td>"
? "</tr>"
? "</table>"
%>
</body>
</html>