Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: how to get image object?

$
0
0

i am about to solve the problem. public $relationCallbacks calls public static function imageByFilename.
Everything works fine, only the last return will cuase an server error: return $image. $image->write(); works fine, but return $image; fails.

Here is the complete function:

public static function imageByFilename(&$obj, $val, $record){
$filename = strtolower(Convert::raw2sql($val));
if($filename && $image = DataObject::get_one('Image',"LOWER(\"Name\") LIKE '%$filename%'")){

if($image->ID){
$image->ClassName = 'Produkte_Image';
$image->write();
return $image;
}
}
return null;
}

Can anybody help?


Posted to: how to get image object? | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles