Skip to content

Commit

Permalink
ADD configuration option to ImageMagick path and make it compatible w…
Browse files Browse the repository at this point in the history
…ith subfolders install
  • Loading branch information
PowerKiKi committed Feb 1, 2011
1 parent ba1be3e commit fcdbb9a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
8 changes: 4 additions & 4 deletions include/controller/photo.php
Expand Up @@ -775,13 +775,13 @@
$lienVignette = $photoManager->getLienPerso($imagePath);

if ($position=='d') {
$htmlImage = "'<a href=\"http://".$_SERVER["SERVER_NAME"]."/".$imagePath."\"><img src=\"http://".$_SERVER["SERVER_NAME"]."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"float:right; margin: 0 0 1em 1em;\" /></a>'";
$htmlImage = "'<a href=\"//".$serveur."/".$imagePath."\"><img src=\"//".$serveur."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"float:right; margin: 0 0 1em 1em;\" /></a>'";
}elseif ($position=='g') {
$htmlImage = "'<a href=\"http://".$_SERVER["SERVER_NAME"]."/".$imagePath."\"><img src=\"http://".$_SERVER["SERVER_NAME"]."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"float:left; margin: 0 1em 1em 0;\" /></a>'";
$htmlImage = "'<a href=\"//".$serveur."/".$imagePath."\"><img src=\"//".$serveur."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"float:left; margin: 0 1em 1em 0;\" /></a>'";
}elseif ($position=='c') {
$htmlImage = "'<a href=\"http://".$_SERVER["SERVER_NAME"]."/".$imagePath."\"><img src=\"http://".$_SERVER["SERVER_NAME"]."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"display:block; margin:0 auto;\" /></a>'";
$htmlImage = "'<a href=\"//".$serveur."/".$imagePath."\"><img src=\"//".$serveur."/".$lienVignette."\" alt=\"".$nomOriginal."\" style=\"display:block; margin:0 auto;\" /></a>'";
}else{
$htmlImage = "'<a href=\"http://".$_SERVER["SERVER_NAME"]."/".$imagePath."\"><img src=\"http://".$_SERVER["SERVER_NAME"]."/".$lienVignette."\" alt=\"".$nomOriginal."\"/></a>'";
$htmlImage = "'<a href=\"//".$serveur."/".$imagePath."\"><img src=\"//".$serveur."/".$lienVignette."\" alt=\"".$nomOriginal."\"/></a>'";
}


Expand Down
3 changes: 3 additions & 0 deletions include/init/config-sample.php
Expand Up @@ -27,4 +27,7 @@

$theme = ''; // koudou, yop, girafe, menhir, chateau, basic, no

// Path to image magick binary, eg: /usr/local/bin/convert or /usr/bin/convert
$imageMagickPath = 'convert';

?>
4 changes: 2 additions & 2 deletions include/lib/application.php
Expand Up @@ -297,12 +297,12 @@ function createThumb($imgpath,$thpath,$new_w=160,$new_h=120,$quality=85){
}

function creeVignette($imgpath, $thpath) {

global $imageMagickPath;
$quality=85;
$imageInfo = getimagesize($imgpath);
$width = $imageInfo[0] * THUMBNAIL_HEIGHT / $imageInfo[1];
$height = THUMBNAIL_HEIGHT;
$command = "/usr/local/bin/convert -thumbnail ".$width."x".$height." -quality $quality \"$imgpath\" \"$thpath\"";
$command = "$imageMagickPath -thumbnail ".$width."x".$height." -quality $quality \"$imgpath\" \"$thpath\"";
exec($command);
}

Expand Down
10 changes: 7 additions & 3 deletions include/manager/photoManager.php
Expand Up @@ -404,7 +404,8 @@ function creeVignette($imagePath,$width=160, $height=120, $quality=85){
}
$thpath = $this->getLienVignette($imagePath);

$commande = "/usr/local/bin/convert -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";
global $imageMagickPath;
$commande = "$imageMagickPath -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";
exec($commande);
}

Expand All @@ -423,7 +424,8 @@ function creeMoyenne($imagePath,$width=640, $height=480, $quality=85){
}
$thpath = $this->getLienMoyenne($imagePath);

$commande = "/usr/local/bin/convert -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";
global $imageMagickPath;
$commande = "$imageMagickPath -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";
exec($commande);
}

Expand All @@ -446,7 +448,9 @@ function creePerso($imagePath,$width=320, $height=240, $quality=85){
$width=320;
$height=240;
}
$commande = "/usr/local/bin/convert -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";

global $imageMagickPath;
$commande = "$imageMagickPath -thumbnail ".$width."x".$height." -quality ".$quality." \"".$imagePath."\" \"".$thpath."\"";
exec($commande);
}

Expand Down

0 comments on commit fcdbb9a

Please sign in to comment.