{
if (isset($q['_remote_upload'])) {
require_once 'System.php';
- static $tmpdir = false;
- if (!$tmpdir) {
- $tmpdir = System::mktemp("-d remote_upload");
- }
+
+ $tmpdir = System::mktemp("-d remote_upload");
$path = $tmpdir . '/' . basename($q['_remote_upload']);
if(!file_exists($path)){
- // use HTTP_Request
file_put_contents($path, file_get_contents($q['_remote_upload']));
}
$ext = $y->toExt(trim((string) $imageInfo['mime'] ));
if (!preg_match("/\." . $ext."$/", $path, $matches)) {
- rename($path,$path.$ext);
+ rename($path,$path.".".$ext);
+ $path.= ".".$ext;
}
+
if (!$this->createFrom($path)) {
$roo->jerr("erro making image" . $q['_remote_upload']);
}
}
-
+
/**
* create an email from file.
* these must have been set first.
// direct via roo...
/// ctrl not used??
- function onUpload($ctrl)
+ function onUpload($roo)
{
-
+// echo $_FILES['imageUpload']['type'];exit;
if (empty($_FILES['imageUpload']['tmp_name']) ||
empty($_FILES['imageUpload']['name']) ||
empty($_FILES['imageUpload']['type'])
$sy = $sz[1];
}
// create it?
-
- return '<img src="' . $this->URL($size, $provider) . '" width="'. $sx . '" height="'. $sy . '">';
+ $extra = '';
+ if (strlen($this->title)) {
+ $extra = ' title="'. htmlspecialchars($this->title) . '"';
+ }
+
+ return '<img src="' . $this->URL($size, $provider) . '"' .
+ $extra .
+ ' width="'. $sx . '"' .
+ ' height="'. $sy . '">';
}
{
// not sure why we do this..
-
-
-
-
// if imgtype starts with '-' ? then we set the 'old' (probably to delete later)
if (!empty($ar['imgtype']) && !empty($ar['ontable']) && !empty($ar['onid']) && ($ar['imgtype'][0] == '-')) {
$this->setFrom($ar);
return; // standard update...
}
- if ( !$this->onUpload($this)) {
- $roo->jerr("File upload failed : ". $this->err);
+
+// print_r(!$this->onUpload($this));
+
+ if ( !$this->onUpload($this)) {
+ $roo->jerr("File upload failed : ". (!empty($this->err) ? $this->err : ''));
}
$roo->addEvent("ADD", $this, $this->toEventString());
return $this->filename .' - on ' . $this->ontable . ':' . $this->onid;
//$p->toEventString();
}
+
}