New: Add patch from meos to resize images

This commit is contained in:
Laurent Destailleur
2010-02-21 01:45:58 +00:00
parent 8e675a9c01
commit ae3cfce7cc
18 changed files with 1746 additions and 54 deletions

View File

@@ -1052,7 +1052,7 @@ function img_object($alt, $object)
/**
* \brief Show picto (generic function)
* \param alt Text on alt and title of image
* \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
* \param picto Name of image file to show (I no extension provided, we use '.png')
* \param options Attribut supplementaire a la balise img
* \param pictoisfullpath If 1, image path is a full path
* \return string Retourne tag img

View File

@@ -25,6 +25,29 @@
*/
/**
* \brief Return size of image file on disk
* \param $file Full path name of file
* \return Array array('width'=>width, 'height'=>height)
*/
function dol_getImageSize($file)
{
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
$ret=array();
if (image_format_supported($file) < 0) return $ret;
$fichier = realpath($file); // Chemin canonique absolu de l'image
$dir = dirname($file); // Chemin du dossier contenant l'image
$infoImg = getimagesize($fichier); // Recuperation des infos de l'image
$ret['width']=$infoImg[0]; // Largeur de l'image
$ret['height']=$infoImg[1]; // Hauteur de l'image
return $ret;
}
/**
* \brief Create a thumbnail from an image file (une small et un mini)

View File

@@ -0,0 +1,29 @@
/*
* http://deepliquid.com/content/Jcrop.html
*/
jQuery(function() {
jQuery('#cropbox').Jcrop({
onSelect: updateCoords,
onChange: updateCoords
});
});
function updateCoords(c)
{
$('#x').val(c.x);
$('#y').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#w').val(c.w);
$('#h').val(c.h);
};
function checkCoords()
{
if (parseInt($('#w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};