theideabulb
asked on
CFImage Center and Crop Question
I am grabbing images when aggregating a blog feed. For the most part this works just fine:
<cfset theImage = ExpandPath(request.base_re lative_url & '/images/uploads/news_imag es/' & variables.tmp_filename)>
<cfset myLargeImg = imageNew(theImage)>
<cfset imageCrop(myLargeImg, (myLargeImg.width/2) - (580/2), (myLargeImg.height/2) - (220/2), 580, 220)>
<cfimage source="#myLargeImg#" action="write" destination="#ExpandPath(r equest.bas e_relative _url & '/images/uploads/news_imag es/'& "large_" & variables.tmp_filename)#" overwrite="yes">
I think the problem I am having is that if the width of the actual image is say only 500px wide, it doesn't do anything at all.
My goal is to make sure that no matter what image is grabbed, I want to create an image that is 580x220 and have whatever it is in the middle of the image. Right now it seems to be skipping the images if they are smaller.
Any ideas on how I can make sure an image is generated with some part of the the grabbed image and have it be 580x200, no matter what.
Thanks
<cfset theImage = ExpandPath(request.base_re
<cfset myLargeImg = imageNew(theImage)>
<cfset imageCrop(myLargeImg, (myLargeImg.width/2) - (580/2), (myLargeImg.height/2) - (220/2), 580, 220)>
<cfimage source="#myLargeImg#" action="write" destination="#ExpandPath(r
I think the problem I am having is that if the width of the actual image is say only 500px wide, it doesn't do anything at all.
My goal is to make sure that no matter what image is grabbed, I want to create an image that is 580x220 and have whatever it is in the middle of the image. Right now it seems to be skipping the images if they are smaller.
Any ideas on how I can make sure an image is generated with some part of the the grabbed image and have it be 580x200, no matter what.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<cfif blogLargeImg.width gte 580 AND blogThumbImg.height gte 220>