From ebda7c0c06abf008d676610f41893936543d46f0 Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Tue, 6 Oct 2015 10:16:41 +0200
Subject: [PATCH] hotline #29412 add debug info

---
 .../opac/views/scripts/cms/article_partial.phtml | 16 ++++++++++++++++
 library/Class/Article.php                        |  4 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/application/modules/opac/views/scripts/cms/article_partial.phtml b/application/modules/opac/views/scripts/cms/article_partial.phtml
index a124b40ca77..ec3d117bb1e 100644
--- a/application/modules/opac/views/scripts/cms/article_partial.phtml
+++ b/application/modules/opac/views/scripts/cms/article_partial.phtml
@@ -9,4 +9,20 @@ $helper = $this->show_content == 'FullContent'
 
 echo $helper->beRenderInBoite()
             ->renderArticle($this->article, 'article');
+
+if(($user = Class_Users::getIdentity()) && $user->isSuperAdmin()) {
+  $url = $this->article->getFirstImageAbsoluteURL();
+  echo is_readable($url) ? 'file readable : ' . $url : 'file not readable : ' . $url ;
+  $url ? (new Class_WebService_Thumbnail_Provider_ImageFactory())->newImage($url) : '';
+
+  echo BR;
+  echo Class_Url::baseUrl();
+  echo BR;
+
+  $path = $this->article->getFirstImagePath();
+  echo is_readable($path)
+                  ? 'file readable : ' . $path
+                  : 'file not readable : ' . $path ;
+}
+
 ?>
diff --git a/library/Class/Article.php b/library/Class/Article.php
index 5cea4c891a7..cd863632543 100644
--- a/library/Class/Article.php
+++ b/library/Class/Article.php
@@ -989,7 +989,9 @@ class Class_Article extends Storm_Model_Abstract {
     if($this->getFileWriter()->fileExists($url))
       return $url;
 
-    $path = str_replace(Class_Url::baseUrl(), '.', $url);
+    $path = str_replace(Class_Url::baseUrl(), '', $url);
+    if(substr($path, 0, 0) == '/')
+      $path = '.' . $path;
 
     if($this->getFileWriter()->fileExists($path))
        return $path;
-- 
GitLab