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:
Julian Seidenberg 2009-09-03 23:30:08 +00:00
parent 844853ab10
commit 43e27fd596

View File

@ -98,7 +98,7 @@ class Image extends File {
* @return string
*/
function getTag() {
if(file_exists("../" . $this->Filename)) {
if(file_exists(Director::baseFolder()."/".$this->Filename)) {
$url = $this->URL();
$title = ($this->Title) ? $this->Title : $this->Filename;
@ -277,7 +277,7 @@ class Image extends File {
if($this->ID && $this->Filename && Director::fileExists($this->Filename)) {
$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);
}
@ -311,7 +311,7 @@ class Image extends File {
function generateFormattedImage($format, $arg1 = null, $arg2 = null) {
$cacheFile = $this->cacheFilename($format, $arg1, $arg2);
$gd = new GD("../" . $this->Filename);
$gd = new GD(Director::baseFolder()."/" . $this->Filename);
if($gd->hasGD()){
@ -319,7 +319,7 @@ class Image extends File {
if($this->hasMethod($generateFunc)){
$gd = $this->$generateFunc($gd, $arg1, $arg2);
if($gd){
$gd->writeTo("../" . $cacheFile);
$gd->writeTo(Director::baseFolder()."/" . $cacheFile);
}
} else {