I sent you an email with an example implementation. I am pasting the
code below for anyone else who might want to try it on their openbd
install.

<html>
<cfsilent>
  <cfparam name="form.imageurl" default="" />
  <cfparam name="form.newheight" default="" />

  <cffunction name="imageResizeHQ" output="no" returntype="void">
        <cfargument name="image" type="any" required="Yes" />
        <cfargument name="height" type="numeric" required="No" default="0" /
>
    <cfset var imageInfo = null />
        <cfset var h = null />
    <cfset imageInfo = imageInfo(image) />
    <cfset h = imageInfo.height />
    <cfloop condition="h NEQ arguments.height">
      <cfif h GT arguments.height>
        <cfset h = (h \ 2) />
        <cfif h LT arguments.height>
          <cfset h = arguments.height />
        </cfif>
      </cfif>
      <cfset imageResize(name=image, height=h, quality="bilinear") />
    </cfloop>
  </cffunction>

  <cffunction name="doResize" output="no" returntype="string">
        <cfargument name="imageUrl" type="string" required="Yes" />
        <cfargument name="height" type="numeric" required="yes" />
    <cfargument name="useMultistep" type="boolean" required="yes" />
    <cfset img = ImageNew(arguments.imageUrl) />
    <cfif useMultistep>
      <cfset imageResizeHQ(img, arguments.height) />
    <cfelse>
      <cfset imageResize(name=img, height=arguments.height,
quality="bilinear") />
    </cfif>
    <cfreturn ToDataUri(ImageGetBlob(img, "jpg"), "image/jpeg") />
  </cffunction>

</cfsilent>
<head>
  <title>Image Resize Comparison</title>
</head>
  <form action="." enctype="multipart/form-data" method="post">
  <label>Image URL:</label> <em>(must be jpeg format)</em><br />
  <input name="imageurl" value="<cfoutput>#form.imageurl#</cfoutput>"
style="width:450px;" /><br />
  <label>New Height:</label> <em>(must be smaller than original height
to see effect)</em><br />
  <input name="newheight" value="<cfoutput>#form.newheight#</
cfoutput>" /><br />
  <input type="submit" value="Resize" />
  </form>
  <cfif len(form.imageurl) AND len(form.newheight) and
isNumeric(form.newheight)>
  <p>Original resize result on the left, multistep resize result on
the right. Note: Your browser must support loading images from data
uris for this to work (Firefox or any webkit browser should work - IE9
works but not sure about older ones)</p>
  <img src="<cfoutput>#doResize(form.imageurl, form.newheight,
false)#</cfoutput>" style="margin:10px;" alt="Original Resize Method"
title="Original Resize Method" />
  <img src="<cfoutput>#doResize(form.imageurl, form.newheight, true)#</
cfoutput>" style="margin:10px;" alt="Multistep Resize Method"
title="Multistep Resize Method" />
  </cfif>
</html>

On Nov 26, 10:56 pm, Alan Holden <[email protected]> wrote:
>   It seems pretty impressive alright.
>
> I would have liked to able to access the raw file paths, rather than
> have the pix pass through this mediafire.com presentation gizmo. Some
> people might worry that it's 'doing something' to taint the results of
> your experiment.
>
> If you don't have a public server, email the images to me off-list and
> I'll be happy to host the (jpg, png, etc) examples for you.
>
> It would be even better if we could host a running "example engine" for
> people to try with their own images!
>
> If adopted; I imagine this would be added as an additional
> option/parameter to the current ImageResize() function, like
> 'isMultiPass'. A global code change would taunt the dependency gods, no?
> Some people may rely on the classic behavior for quirks (those who want
> processor speed and not quality, for example).
>
> My .02 for the topic
> Al

-- 
online documentation: http://openbd.org/manual/
   google+ hints/tips: https://plus.google.com/115990347459711259462
     http://groups.google.com/group/openbd?hl=en

Reply via email to