Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 25th, 2006, 4:08 AM   #1
ktsirig
Programmer
 
Join Date: Oct 2005
Posts: 54
Rep Power: 3 ktsirig is on a distinguished road
zoom functionality?

Hello,
I have some pictures on my page that I want to add zooming functionality, that is, when a visitor clicks on an image, he will be able to zoom in and out on it.
Any ideas on how this can be done?
ktsirig is offline   Reply With Quote
Old Oct 25th, 2006, 4:50 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's called resizing. Google for things like bicubic, bilinear. Some languages have supportive libraries for it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 25th, 2006, 7:53 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,464
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
You could use DHTML:

http://resources.bravenet.com/script...es/image_zoom/

more: http://www.google.com/search?sourcei...tml+image+zoom
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Oct 25th, 2006, 12:02 PM   #4
ktsirig
Programmer
 
Join Date: Oct 2005
Posts: 54
Rep Power: 3 ktsirig is on a distinguished road
well, I have something coded in Javacript that seems to work. But it changes the dimensions of the picture, while I want it to zoom in depth and not change the initial dimensions.

I have written:
<html>
<body>
<img src="picture" width="86" height="37" onclick="this.width = this.width*2; this.height = this.height*2" id="image" />
<br />
<a href="java script:void(0);" onclick="document.getElementById('image').width = document.getElementById('image').width/2; document.getElementById('image').height = document.getElementById('image').height/2;">Zoom out</a>
<br />Click on image to zoom in
</body>
</html>
ktsirig is offline   Reply With Quote
Old Oct 25th, 2006, 1:45 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Use the CSS clip property on your image.
style="clip: rect(toplimitpx, rightlimitpx, bottomlimitpx, leftlimitpx);"

If you want to zoom to the center, then you'll need to reposition the image to put the center in the clip region.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC