Bonjour, j'ai un script de croppage avec jquery qui fonctionne parfaitement.

Cependant, j'ai une image xl.jpg à 300Dpi. Je la crop, elle passe à 72Dpi.

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
 if ($_SERVER['REQUEST_METHOD'] == 'POST'){
	$targ_w = $_POST['w']*5;
	$targ_h = $_POST['h']*5;
	$jpeg_quality = 100;
 
	$src = "xl.jpg";
	$img_r = imagecreatefromjpeg($src);
	$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
 
	imagecopyresampled($dst_r,$img_r,0,0,$_POST['x']*5,$_POST['y']*5,
	$targ_w,$targ_h,$_POST['w']*5,$_POST['h']*5);
 
 
	imagejpeg($dst_r,"xl_crop.jpg",$jpeg_quality);
        imagedestroy($dst_r,"xl_crop.jpg",$jpeg_quality);
 
	echo '
<script language="Javascript">
window.location="crop_image.php?file='.$_GET["file"].'&&step=3";
</script>';
 
}
J'ai cherché sans succès pour trouver comment conserver les DPI de l'image.