Subversion Repositories Applications.projet

Compare Revisions

Regard whitespace Rev 319 → Rev 320

/trunk/fichier_attache.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier_attache.php,v 1.1 2006-04-19 13:51:57 alexandre_tb Exp $
// CVS : $Id: fichier_attache.php,v 1.2 2008-08-25 15:27:32 alexandre_tb Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
41,12 → 41,12
// +------------------------------------------------------------------------------------------------------+
 
// A faire
 
set_include_path(get_include_path().':../../api/pear/');
include_once 'configuration/projet.config.inc.php' ;
include_once ('classes/ezmlmAccessObject.class.php') ;
include_once 'Mail/mimeDecode.php' ;
include_once 'Net/URL.php' ;
 
 
$num_rep = array_shift ($actionargs) ;
$num_message = array_shift($actionargs) ;
 
74,7 → 74,6
for ($i = 0; $i < count ($actionargs); $i++) {
$part = getParts($mailDecode, $actionargs[$i]) ;
}
 
$content_type = $part->ctype_primary.'/'.$part->ctype_secondary ;
 
// Certain fichiers attaché n'ont pas de ctype_primary et ctype_secondary
82,17 → 81,64
$content_type = $part->content_type;
}
 
$tableau_type_image = array ('jpg', 'jpeg', 'pjpeg');
 
if (isset($_GET['min']) && (in_array ($part->ctype_secondary, $tableau_type_image))) {
$chemin = $PHP_SELF.'?'.$_SERVER["QUERY_STRING"]; // le chemin en absolu
$url = new Net_URL($chemin);
$url->removeQueryString('min');
$chemin = $url->getURL();
 
// vous pouvez travailler en url relative aussi: img.jpg
$x = 500; # largeur a redimensionner
$y = 150; # hauteur a redimensionner
//echo $chemin;
$im = imagecreatefromjpeg($chemin);
$ow = imagesx($im);
$oh = imagesy($im);
$mw = 200; // max width
$mh = 200; // max height
if( $ow > $mw || $oh > $mh ) {
if( $ow > $oh ) {
$tnw = $mw;
$tnh = $tnw * $oh / $ow;
} else {
$tnh = $mh;
$tnw = $tnh * $ow / $oh;
}
} else {
$tnw = $ow;
$tnh = $oh;
}
$imtn = imagecreatetruecolor($tnw, $tnh);
if (!imagecopyresized($imtn, $im, 0, 0, 0, 0, $tnw, $tnh, $ow, $oh)) {
$erreur = 'Photo %s. Redimensionnement impossible : %s.'."\n";
}
Header("Content-type: image/jpeg");
if (!imagejpeg($imtn)) {
$erreur = 'Photo %s. Création de l\'image redimenssionnée impossible : %s.'."\n";
}
imagedestroy($im);
imagedestroy($imtn);
exit();
}
 
 
$nom_du_fichier = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : $part->ctype_parameters['name'] ;
//echo $content_type ;
//var_dump ($part);
 
header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
header('Cache-Control: Public');// HTTP/1.1
header ('Content-Type: '.$content_type."\r\n") ;
header("Content-Length: ".strlen($part->body).";\r\n");
header ('Content-Disposition: attachment; filename="'.$nom_du_fichier.'"'."\r\n");
header('Content-Transfer-Encoding: '.$part->content-transfer-encoding);
header('Content-Type: '.$content_type) ;
header('Content-Length: '.strlen($part->body).";");
header('Content-Disposition: attachment; filename="'.$nom_du_fichier.'"');
//header('Content-Transfer-Encoding: '.$part->content-transfer-encoding);
echo $part->body ;
exit(0) ;
 
?>
?>