projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4ca8d7a
)
try using alternative search for filename
author
Alan
<alan@roojs.com>
Mon, 27 Mar 2023 04:22:41 +0000
(12:22 +0800)
committer
Alan
<alan@roojs.com>
Mon, 27 Mar 2023 04:22:41 +0000
(12:22 +0800)
DataObjects/Images.php
patch
|
blob
|
history
Images.php
patch
|
blob
|
history
diff --git
a/DataObjects/Images.php
b/DataObjects/Images.php
index
537a68f
..
907b890
100644
(file)
--- a/
DataObjects/Images.php
+++ b/
DataObjects/Images.php
@@
-200,10
+200,13
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
*
* @return - target file name
*/
*
* @return - target file name
*/
- function getStoreName()
+ function getStoreName(
$alt = false
)
{
$opts = HTML_FlexyFramework::get()->Pman;
$fn = preg_replace('/[^a-z0-9_\.]+/i', '_', $this->filename);
{
$opts = HTML_FlexyFramework::get()->Pman;
$fn = preg_replace('/[^a-z0-9_\.]+/i', '_', $this->filename);
+ if ($alt) {
+ $fn = preg_replace('/[^a-z0-9\.]+/i', '_', $this->filename);
+ }
return implode( '/', array(
$opts['storedir'], '_images_', date('Y/m', strtotime($this->created)), $this->id . '-'. $fn
));
return implode( '/', array(
$opts['storedir'], '_images_', date('Y/m', strtotime($this->created)), $this->id . '-'. $fn
));
@@
-668,6
+671,11
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
*/
function toFileConvert()
{
*/
function toFileConvert()
{
+ $fn = $this->getStoreName();
+ if (!file_exists($fn)) {
+ $fn = $this->getStoreName(true);
+ }
+
require_once 'File/Convert.php';
$fc = new File_Convert($this->getStoreName(), $this->mimetype);
return $fc;
require_once 'File/Convert.php';
$fc = new File_Convert($this->getStoreName(), $this->mimetype);
return $fc;
diff --git
a/Images.php
b/Images.php
index
c33e8f4
..
92c99e9
100644
(file)
--- a/
Images.php
+++ b/
Images.php
@@
-285,7
+285,7
@@
class Pman_Core_Images extends Pman
{
$this->sessionState(0); // turn off session... - locking...
require_once 'File/Convert.php';
{
$this->sessionState(0); // turn off session... - locking...
require_once 'File/Convert.php';
- if (!file_exists($img->getStoreName())) {
+ if (!file_exists($img->getStoreName())
&& !file_exists($img->getStoreName(true))
) {
// print_r($img);exit;
header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' .
urlencode("Original file was missing : " . $img->getStoreName()));
// print_r($img);exit;
header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' .
urlencode("Original file was missing : " . $img->getStoreName()));