how would i do that?
Main Topics
Browse All TopicsIm resizing my images to create thumbnails using the <cfimage> tag but I want them to appear larger in a div
elsewhere on my page ( proportionally scaled ) onMouseOver.
The following code works for re-sizing the images ::
--------------------------
<!--- Create a square thumbnail --->
<cffunction name="squareThumbnail" access="private" returntype="void">
<cfargument name="image" required="true" />
<cfargument name="size" required="true" />
<cfset var half = int(arguments.size / 2) />
<cfset var fromX = 0 />
<cfset var fromY = 0 />
<!--- Resize image by height if width is greater then height --->
<cfif arguments.image.height gt arguments.image.width>
<cfset imageResize(arguments.imag
<cfset fromX = arguments.image.Height / 2 - half />
<cfset imageCrop(arguments.image,
<!--- Resize image width if height is greater then width --->
<cfelseif image.width gt image.height>
<cfset imageResize(arguments.imag
<cfset fromY = arguments.image.Width / 2 - half />
<cfset imageCrop(arguments.image,
<!--- Already Square, can do a resize with no cropping --->
<cfelse>
<cfset imageResize(arguments.imag
<cfset imageCrop(arguments.image,
</cfif>
<cfimage action="writetobrowser" source="#arguments.image#"
</cffunction>
--------------------------
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
What do you want to do?
In HTTP you cannot do <img> tag handling inside the image content stream.
So what is your question when you ask "how would i do that?"
What do you want to do? Do you want to write an <img> tag with onMouseOver event handler?
Or do you still ask how to stream out that event handler together with the image content bytes?
Do you really ask how to write an <img onMouseOver="showImage(thi
The following code pulls my images from a database.
- Creates a thumbnail on the left and a mouseover that shows the full image in a div on the right.
( however it does not crop images to proportion and the full images are larger than the page. )
*** I'd like to use the function to create the thumbnails instead as it proportionally crops the images
and keep the same functionality where a user could mouseover to see the main image. I would also like for the main image to be proportional ( to a pre-specified size/ fit to window since some of the images are really big ).
I was hoping to keep the thumbnails all the same size / square but the main image that appears on the right is not getting scaled to fit the div either ( height = 500 width=auto )...?
--------------------------
-- The cfimage does such a nicer job at making the thumbs and keeps them looking clear. Is there no way to add "onmouseover" using arguments or anything?
I still cant get the thumbs to come out right proportionally square.
( the way the cfimage tag works with cropping )
-- I still think there has to be some way to add a mouseover to cfimage... Anyone?
I fixed my main image size by adding :
--------------------------
<style>
.myImg{
width: auto;
height: 475px;
}
</style>
--------------------------
Changed this line to:
var myInsert="<img class='myImg' src='/ServerPages/WareHous
And changed this line to :
<img class="myImg" src="/ServerPages/WareHous
--------------------------
Business Accounts
Answer for Membership
by: ZvonkoPosted on 2008-03-30 at 13:09:24ID: 21241783
The image stream function produces ONLY the image content. To controll the events for that particular image tag placement you have to add event handlers to the page that USES the image tag.