mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Ticket #4297 - Use Director::baseFolder instead of relative links in sapphire/core/Image.php
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@85700 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
844853ab10
commit
43e27fd596
@ -98,7 +98,7 @@ class Image extends File {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getTag() {
|
function getTag() {
|
||||||
if(file_exists("../" . $this->Filename)) {
|
if(file_exists(Director::baseFolder()."/".$this->Filename)) {
|
||||||
$url = $this->URL();
|
$url = $this->URL();
|
||||||
$title = ($this->Title) ? $this->Title : $this->Filename;
|
$title = ($this->Title) ? $this->Title : $this->Filename;
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ class Image extends File {
|
|||||||
if($this->ID && $this->Filename && Director::fileExists($this->Filename)) {
|
if($this->ID && $this->Filename && Director::fileExists($this->Filename)) {
|
||||||
$cacheFile = $this->cacheFilename($format, $arg1, $arg2);
|
$cacheFile = $this->cacheFilename($format, $arg1, $arg2);
|
||||||
|
|
||||||
if(!file_exists("../".$cacheFile) || isset($_GET['flush'])) {
|
if(!file_exists(Director::baseFolder()."/".$cacheFile) || isset($_GET['flush'])) {
|
||||||
$this->generateFormattedImage($format, $arg1, $arg2);
|
$this->generateFormattedImage($format, $arg1, $arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ class Image extends File {
|
|||||||
function generateFormattedImage($format, $arg1 = null, $arg2 = null) {
|
function generateFormattedImage($format, $arg1 = null, $arg2 = null) {
|
||||||
$cacheFile = $this->cacheFilename($format, $arg1, $arg2);
|
$cacheFile = $this->cacheFilename($format, $arg1, $arg2);
|
||||||
|
|
||||||
$gd = new GD("../" . $this->Filename);
|
$gd = new GD(Director::baseFolder()."/" . $this->Filename);
|
||||||
|
|
||||||
|
|
||||||
if($gd->hasGD()){
|
if($gd->hasGD()){
|
||||||
@ -319,7 +319,7 @@ class Image extends File {
|
|||||||
if($this->hasMethod($generateFunc)){
|
if($this->hasMethod($generateFunc)){
|
||||||
$gd = $this->$generateFunc($gd, $arg1, $arg2);
|
$gd = $this->$generateFunc($gd, $arg1, $arg2);
|
||||||
if($gd){
|
if($gd){
|
||||||
$gd->writeTo("../" . $cacheFile);
|
$gd->writeTo(Director::baseFolder()."/" . $cacheFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user