projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d81e1cd
)
fix shorten name for jpeg
author
Alan
<alan@roojs.com>
Thu, 24 Aug 2023 02:28:36 +0000
(10:28 +0800)
committer
Alan
<alan@roojs.com>
Thu, 24 Aug 2023 02:28:36 +0000
(10:28 +0800)
DataObjects/Images.php
patch
|
blob
|
history
Images.php
patch
|
blob
|
history
diff --git
a/DataObjects/Images.php
b/DataObjects/Images.php
index
0f30c83
..
8c6cabf
100644
(file)
--- a/
DataObjects/Images.php
+++ b/
DataObjects/Images.php
@@
-593,12
+593,13
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
$fc = $this->toFileConvert();
// print_r($size);
// exit;
$fc = $this->toFileConvert();
// print_r($size);
// exit;
- $mt = $to_type == false ? $this->mimetype : $to_type;
+ $mt = $to_type ==
=
false ? $this->mimetype : $to_type;
if (!preg_match('#^image/#i',$mt)) {
$mt = 'image/jpeg';
}
if (!preg_match('#^image/#i',$mt)) {
$mt = 'image/jpeg';
}
- $fc->convert($mt, $size);
+ $cn = $fc->convert($mt, $size);
+ $shorten_name = $this->shorten_name(basename($cn));
return $baseURL . $provider . "/$size/{$this->id}/{$shorten_name}"; // -- this breaks the rss feed #image-{$this->id}";
}
return $baseURL . $provider . "/$size/{$this->id}/{$shorten_name}"; // -- this breaks the rss feed #image-{$this->id}";
}
@@
-631,13
+632,14
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
}
}
- function shorten_name()
+ function shorten_name(
$fn = false
)
{
if(empty($this->filename)) {
return;
}
{
if(empty($this->filename)) {
return;
}
+ $fn = $fn === false ? $this->filename : $fn;
- $filename = explode('.', $
this->filename
);
+ $filename = explode('.', $
fn
);
$ext = array_pop($filename);
$name = preg_replace("/[^A-Z0-9.]+/i", '-', implode('-', $filename)) ;
$ext = array_pop($filename);
$name = preg_replace("/[^A-Z0-9.]+/i", '-', implode('-', $filename)) ;
diff --git
a/Images.php
b/Images.php
index
2f2ae0c
..
62d760c
100644
(file)
--- a/
Images.php
+++ b/
Images.php
@@
-87,7
+87,9
@@
class Pman_Core_Images extends Pman
//if (!empty($_GET['_post'])) {
// return $this->post();
//}
//if (!empty($_GET['_post'])) {
// return $this->post();
//}
-
+
+
+
$this->is_local = (!empty($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') ? true : false;
$this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as'];
$this->is_local = (!empty($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') ? true : false;
$this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as'];
@@
-286,6
+288,7
@@
class Pman_Core_Images extends Pman
function serve($img)
{
function serve($img)
{
+
$this->sessionState(0); // turn off session... - locking...
require_once 'File/Convert.php';
if (!$img->exists()) {
$this->sessionState(0); // turn off session... - locking...
require_once 'File/Convert.php';
if (!$img->exists()) {
@@
-297,6
+300,8
@@
class Pman_Core_Images extends Pman
if (empty($this->as_mimetype) || $img->mimetype == 'image/gif') {
$this->as_mimetype = $img->mimetype;
}
if (empty($this->as_mimetype) || $img->mimetype == 'image/gif') {
$this->as_mimetype = $img->mimetype;
}
+
+
if (!$this->thumb) {
if ($x->mimetype == $this->as_mimetype) {
$x->serveOnly($this->method, $img->filename);
if (!$this->thumb) {
if ($x->mimetype == $this->as_mimetype) {
$x->serveOnly($this->method, $img->filename);
@@
-328,6
+333,7
@@
class Pman_Core_Images extends Pman
if (!file_exists($fn)) {
$this->validateSize();
}
if (!file_exists($fn)) {
$this->validateSize();
}
+
if(!empty($this->page) && !is_nan($this->page * 1)){
$x->convert( $this->as_mimetype, $this->size, 0, $this->page);
if(!empty($this->page) && !is_nan($this->page * 1)){
$x->convert( $this->as_mimetype, $this->size, 0, $this->page);