January 26, 2006
Resizing images in the page - a cool technology tip
Last month I wrote about Cucusoft's iPod Video Converter for converting DVDs to iPod video, and included a screenshot of the app in action. As usual with screenshots, I had to choose between having the image appear full-size and crystal clear, or having it reduced to fit better on the page but have visble and objectionable artifacts from the resizing. Looking around for a CSS/Javascript solution, I came upon John Berry's elegant solution on his Agile Partners Weblog - a movable slider to resize the image on the fly. Drag the slider to see it work!
This script uses the Prototype and script.aculo.us javascript libraries. Scriptaculous builds upon Prototype and adds some amazing DHTMLeffects, including the slider control used in this demo. You can view source on this page to see the complete code that does this, but in a nutshell, you:
- download and include the
Prototype and Scriptaculous javascript libraries to your page:
<script src="scripts/prototype.js" type="text/javascript" language="javascript"></script>
<script src="scripts/scriptaculous.js" type="text/javascript" language="javascript"></script>
- add
the html for the slider and the image file.. Note that you may resize a
collection of images by adding additional <DIV class='scale-image'> elements within the enclosing
<div>
<div style="border: 0px solid #ddd; width: 695px; overflow: auto; float:left;">
<div class="scale-image" style="width: 695px; padding: 10px; float: left;">
<img src="http://www.emediacommunications.biz/files/cucusoftdvdtoipod.jpg" width="100%"/>
</div>
</div>
- and
the HTML for the slider itself
<div id="track1" style="border:1px solid #BBCCDD; width: 200px; background-image: url('files/scaler_slider_track.gif'); background-repeat: repeat-x; background-position: center left; height:18px; margin: 4px 0 0 10px;">
<div id="handle1" style="width: 18px; height: 18px;">
<img src="files/scaler_slider_gray.gif"/>
</div><a href="#" style="font-size:small; float:right;" onClick="setSlider(1); return false;">[view full-size]</a>
</div>
- finally, include the custom resize_slider.js
script in your page. This must go after the slider HTML in your page.
<script type="text/javascript" src="resize_slider.js" ></script>
Here's another great example of this script in action.
Posted by larryb at 06:45 PM [permanent link]
| TrackBacks (0)
Category: Innovative Technology , Web and Software Development
Category: Innovative Technology , Web and Software Development
TrackBack URL for this entry:
http://www.learningapi.com/cgi-bin/mt-tb.cgi/85
Listed below are links to weblogs that reference 'Resizing images in the page - a cool technology tip' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.
http://www.learningapi.com/cgi-bin/mt-tb.cgi/85
Listed below are links to weblogs that reference 'Resizing images in the page - a cool technology tip' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.
Search
Archives
Recent Entries
Facebook and Academic Institutions - Content or Context?
Video Transcript Browsing Interface
The New RealPlayer 11 - A First Look
Is RealPlayer going to make a comeback?
Is Amazon's S3 the cheapest streaming video hosting out there?
Image, Audio & Video Search - Reading Content and Context
e-Learning 2.0 - The End of the Course?
Online Video and Web 2.0 - What's missing?
Fundamentals of Website Development - Course Resources
A Full-Featured Flash Video Player
Video Transcript Browsing Interface
The New RealPlayer 11 - A First Look
Is RealPlayer going to make a comeback?
Is Amazon's S3 the cheapest streaming video hosting out there?
Image, Audio & Video Search - Reading Content and Context
e-Learning 2.0 - The End of the Course?
Online Video and Web 2.0 - What's missing?
Fundamentals of Website Development - Course Resources
A Full-Featured Flash Video Player
Author Links
About the author
Speaking Engagements
Streaming and Multimedia Articles and Tutorials
My Harvard Business School Bio page
Blogroll
Digital Media Bulletin - Jose Alvear
ResearchForward - Michael J. Hemment
BusinessOfVideo.com
Online Video Punch
The Learning Circuits Blog
Elatable - Bradley Horowitz
Harold Jarche
HBS Prof. Andy McAfee on Web 2.0
DV for Teachers
SciTech Daily Review
Quirksmode - Javascript & AJAX
Educational Technology & Life
Jon Udell
Learning Technology - Denis Saulnier
Weblog Categories
Digital Restrictions Management
eLearning & Instructional Technology
Innovative Technology
Misc
Personal Video Publishing
Streaming Media
Streaming Media Technology Tips
Video and Multimedia Technology
Web and Software Development
Weblogs
External Links
