Before I go and file a bug report, I wanted to run an issue by everyone here.

I am writing a tiny script to create thumbnails with images. In this processes, there maybe some images that are to long, and readjusted by height instead of width. Now to cut down on the amount of scripting I am doing, I am resizing the image and pasting it into a a blank thumbnail of proper size (I set the page to size all images by a width of 300px).

I spent the better part of an hour pulling out my hair trying to get it to paste an image together. I have come to the conclusion you can not paste an image loaded from disk onto an image created in memory space.

as an example, I did the following:

<cfset blImage = ImageNew( width=300, height=270, type="rgb" ) > <!--- this is where I create my blank template ---> <cfset reImage = ImageNew( "#imageDir#/#arrFiles#" )><!--- this is the image before resize from the disk ---><cfset thisWidth = ImageGetwidth(reImage)>
<cfset thisHeight = ImageGetheight(reImage)>
<cfset ratio = thisWidth / 300>
<cfset newH = ROUND(thisHeight / ratio) >
<cfset newW = 300 />
<cfif newH GT 270>
    <cfset newH = 270 />
    <cfset ratio = thisHeight / 270 />
    <cfset newW = round( thisWidth / ratio) />
    <cfset error = ImageResize( reImage, newW, newH ) >
    <cfset ImagePaste( blImage, reImage, 150, 150 )>
<cfset error = ImageWrite( blImage, "#imageDir#/t_#arrFiles#", "1", "1")>
</cfif>

When I look at the image all it is, is a blank white square, nothing pasted into it. And yes, I put to disk each image create at each phase. IE, i tested newImage put a new image out by saving it, as well as the image that is to be pasted into the new one.

However, what DOES work, is if you pull the blImage from the disk. Then yes, you will be able to paste them together.

Bug? By Design?


--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

--- You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to