Jump to content

xpoitau

Members
  • Posts

    5
  • Joined

  • Last visited

xpoitau's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Bonjour, pour l'intégration de Archiduchesse, nous avons fait autrement et peut-être plus simple. Nous avons remplacé le code dans index.php par : <?php // axome on ouvre la rubrique 5 par defaut sur la page d'accueil $_GET["id_category"] = 5; include(dirname(__FILE__).'/category.php'); /* include(dirname(__FILE__).'/config/config.inc.php'); if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1) $rewrited_url = __PS_BASE_URI__; include(dirname(__FILE__).'/header.php'); $smarty->assign('HOOK_HOME', Module::hookExec('home')); $smarty->display(_PS_THEME_DIR_.'index.tpl'); include(dirname(__FILE__).'/footer.php'); */ ?> 5 étant à remplacer par le numéro de la catégorie à ouvrir. Xavier www.axome.com
  2. Voici ma petite bidouille pour remplacer GD par imagemagick dans images.inc.php remplacer la fonction ---- function imageResize($sourceFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg') { list($sourceWidth, $sourceHeight, $type, $attr) = getimagesize($sourceFile); if (!$sourceWidth) return false; if ($destWidth == NULL) $destWidth = $sourceWidth; if ($destHeight == NULL) $destHeight = $sourceHeight; $sourceImage = createSrcImage($type, $sourceFile); $widthDiff = $destWidth / $sourceWidth; $heightDiff = $destHeight / $sourceHeight; if ($widthDiff > 1 AND $heightDiff > 1) { $nextWidth = $sourceWidth; $nextHeight = $sourceHeight; } else { if (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) { $nextHeight = $destHeight; $nextWidth = intval(($sourceWidth * $nextHeight) / $sourceHeight); $destWidth = (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 ? $destWidth : $nextWidth); } else { $nextWidth = $destWidth; $nextHeight = intval($sourceHeight * $destWidth / $sourceWidth); $destHeight = (intval(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 ? $destHeight : $nextHeight); } } $borderWidth = intval(($destWidth - $nextWidth) / 2); $borderHeight = intval(($destHeight - $nextHeight) / 2); /* $destImage = imagecreatetruecolor($destWidth, $destHeight); $white = imagecolorallocate($destImage, 255, 255, 255); imagefill($destImage, 0, 0, $white); imagecopyresampled($destImage, $sourceImage, $borderWidth, $borderHeight, 0, 0, $nextWidth, $nextHeight, $sourceWidth, $sourceHeight); imagecolortransparent($destImage, $white); */ // ajout pour imagemagick $bordure = $borderWidth+$borderHeight; $cmd = "convert -size ".$sourceWidth."x".$sourceHeight." ".$sourceFile." -resize ".$nextWidth."x".$nextHeight." -bordercolor white -border ".$bordure."x".$bordure." -gravity center -crop ".$destWidth."x".$destHeight."+0+0 ".$destFile; exec($cmd); return (returnDestImage($fileType, $destImage, $destFile)); } et aussi la fonction : function returnDestImage($type, $ressource, $filename) { /* $flag = false; switch ($type) { case 'gif': $flag = imagegif($ressource, $filename); break; case 'png': $flag = imagepng($ressource, $filename, 7); break; case 'jpeg': default: $flag = imagejpeg($ressource, $filename, 90); break; } imagedestroy($ressource); return $flag; */ if (file_exists("$filename")) { return true; } else { return false; } } bien sûr, il faut avoir imagemagick installé et la possibilité d'exécuter des commandes en php. Xavier axome.com images.inc.php
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More