mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 19:18:22 +01:00
New: Add patch from meos to resize images
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
29
htdocs/lib/lib_photosresize.js
Normal file
29
htdocs/lib/lib_photosresize.js
Normal 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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user