images des sources avec mw_thumbs si dispo
authordj3c1t <dj3c1t@free.fr>
Fri, 9 May 2014 17:50:17 +0000 (19:50 +0200)
committerdj3c1t <dj3c1t@free.fr>
Fri, 9 May 2014 17:50:17 +0000 (19:50 +0200)
app/out/default/views/sources/source/header.php

index 1fbe626..51d654a 100644 (file)
   <?php endif; ?>
   <?php if(!isset($display_name) || $display_name) : ?>
   <?php
-  
-    $HAS_IMAGE = false;
+
+
+
+    $source_image_url = false;
     if($source["reference"]){
       if(
            isset($source["reference"]["image"])
         && $source["reference"]["image"]
-        && ($img_size = $data->img_size($source["reference"]["image"], 100, 100)) !== false
       ){
-        $HAS_IMAGE = true;
-        $source_image_uri = $source["reference"]["image"];
+        $source_image_url = $source["reference"]["image"];
       }
     }
     else{
       if
-      (    $source["image_uri"]
+      (    isset($source["image_uri"])
+        && $source["image_uri"]
         && file_exists($source["image_uri"])
-        && ($img_size = $data->img_size($source["image_uri"], 100, 100)) !== false
       ){
-        $HAS_IMAGE = true;
-        $source_image_uri = $this->path("web").$source["image_uri"];
+        $source_image_url = $source["image_uri"];
+      }
+    }
+    if($source_image_url){
+      $source_thumb = false;
+      if($data->mw_thumbs_activated()){
+        $source_thumb = $data->img_thumb(
+          $source_image_url,
+          100,
+          100,
+          $this->path("content")."thumbs",
+          array(255, 255, 255)
+        );
       }
     }
-    if($HAS_IMAGE) :
 
   ?>
+  <?php if($source_image_url) : ?>
   <p class="logo_source">
     <a href="<?php echo $source["reference"] ? $source["reference"]["from"] : $source["url"] ?>">
-      <img src="<?php echo $source_image_uri ?>"
-           width="<?php echo $img_size["width"] ?>"
-           height="<?php echo $img_size["height"] ?>"
+      <?php if($source_thumb) : ?>
+      <img src="<?php echo $this->path("content")."thumbs/".$source_thumb["thumb_file"] ?>"
+           width="<?php echo $source_thumb["thumb_width"] ?>"
+           height="<?php echo $source_thumb["thumb_height"] ?>"
            alt="" />
+      <?php else : ?>
+      <img src="<?php echo $source_image_url ?>" style="width: 100px; height: auto" alt="" />
+      <?php endif; ?>
     </a>
   </p>
   <?php endif; ?>
-  <h1<?php if($HAS_IMAGE): ?> class="with_image"<?php endif; ?>>
+  <h1<?php if($source_image_url): ?> class="with_image"<?php endif; ?>>
     <?php if($source["reference"]) : ?>
     <span>r&eacute;f&eacute;rence &raquo; <a href="<?php echo $source["reference"]["from"] ?>"><strong><?php echo $source["reference"]["titre"] ?></strong></a></span>
     <?php else : ?>