extranet/application/controllers/FichierController.php

41 lines
1.1 KiB
PHP

<?php
class FichierController extends Zend_Controller_Action
{
public function indexAction()
{
$request = $this->getRequest();
print_r($request->getParams());
exit;
}
public function logoAction()
{
$request = $this->getRequest();
print_r($request->getParams());
exit;
}
public function imgcacheAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$content_type = 'image/png';
$path = APPLICATION_PATH.'/../cache/pages/imgcache/';
$file = $this->getRequest()->getParam('fichier');
if ( file_exists($path.$file) ) {
header('Content-Transfer-Encoding: none');
header('Content-type: ' . $content_type.'');
header('Content-Length: ' . filesize($path.$file));
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
header('Content-Disposition: filename="' . basename($path.$file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression', '0');
echo file_get_contents($path.$file);
} else {
echo 'Impossible de charger le fichier.';
}
}
}