[ Index ] |
|
Code source de Horde 3.1.3 |
1 /** 2 * Horde Image Javascript 3 * 4 * Provides the javascript to help during the uploading of images in Horde_Form. 5 * 6 * $Horde: horde/js/image.js,v 1.3.4.3 2006/01/01 21:29:02 jan Exp $ 7 * 8 * Copyright 2003-2006 Marko Djukic <marko@oblo.com> 9 * 10 * See the enclosed file COPYING for license information (LGPL). If you did not 11 * receive this file, see http://www.fsf.org/copyleft/lgpl.html. 12 */ 13 14 /** 15 * Changes the src of an image target, optionally attaching a time value to the 16 * URL to make sure that the image does update and not use the browser cache. 17 * 18 * @param string src The srouce to inserted into the image element. 19 * @param string target The target element. 20 * @param optional bool no_cache If set to true will append the time. 21 * 22 * @return bool False to stop the browser loading anything. 23 */ 24 function showImage(src, target, no_cache) 25 { 26 var img = document.getElementById(target); 27 if (typeof no_cache == 'undefined') { 28 var no_cache = false; 29 } 30 31 if (no_cache) { 32 var now = new Date(); 33 src = src + '&' + now.getTime(); 34 } 35 36 img.src = src; 37 38 return false; 39 } 40 41 /** 42 * Adds to the given source the height/width field values for the given target. 43 * 44 * @param string src The srouce to append to the resize params. 45 * @param string target The target element. 46 * @param optional bool ratio If set to true will append fix the ratio. 47 * 48 * @return string The modified source to include the resize data. 49 */ 50 function getResizeSrc(src, target, ratio) 51 { 52 var width = document.getElementById('_w_' + target).value; 53 var height = document.getElementById('_h_' + target).value; 54 if (typeof ratio == 'undefined') { 55 var ratio = 0; 56 } 57 58 src = src + '&' + 'v=' + width + '.' + height + '.' + ratio; 59 60 return src; 61 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |