updates
Fixed inline and attachment issues
This commit is contained in:
@@ -169,7 +169,7 @@ class StorageController extends Controller {
|
||||
$upload->size = $size;
|
||||
$upload->poster = $disposition;
|
||||
$upload->driver = $this->default;
|
||||
$upload->path = $this->root;
|
||||
$upload->path = $this->root. DIRECTORY_SEPARATOR.'attachments';
|
||||
if ($this->default !== 'database') {
|
||||
$this->setFileSystem();
|
||||
Storage::disk($this->default)->put($filename, $data);
|
||||
@@ -205,7 +205,7 @@ class StorageController extends Controller {
|
||||
$size = $attachment->getSize();
|
||||
$data = file_get_contents($attachment->getRealPath());
|
||||
}
|
||||
$filename = $this->upload($data, $filename, $type, $size, $disposition, $thread_id);
|
||||
$this->upload($data, $filename, $type, $size, $disposition, $thread_id);
|
||||
$thread = $this->updateBody($attachment, $thread_id, $filename);
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,9 @@ class StorageController extends Controller {
|
||||
if ($disposition == 'INLINE' || $disposition == 'inline') {
|
||||
$id = str_replace('>', '', str_replace('<', '', $structure->id));
|
||||
$body = $thread->body;
|
||||
// dd($id,$filename,$body);
|
||||
$body = str_replace('cid:' . $id, $filename, $body);
|
||||
// dd($body);
|
||||
$thread->body = $body;
|
||||
$thread->save();
|
||||
}
|
||||
@@ -232,7 +234,7 @@ class StorageController extends Controller {
|
||||
|
||||
public function getFile($drive, $name, $root) {
|
||||
if ($drive != "database") {
|
||||
$root = $root . "/" . $name;
|
||||
$root = $root . DIRECTORY_SEPARATOR . $name;
|
||||
if (\File::exists($root)) {
|
||||
chmod($root, 0755);
|
||||
return \File::get($root);
|
||||
|
@@ -25,6 +25,7 @@ class Ticket_attachments extends Model
|
||||
$drive = $this->driver;
|
||||
$name = $this->name;
|
||||
$root = $this->path;
|
||||
|
||||
if (($drive == 'database' || !$drive) && $value && base64_decode($value, true) === false) {
|
||||
$value = base64_encode($value);
|
||||
}
|
||||
@@ -33,7 +34,6 @@ class Ticket_attachments extends Model
|
||||
$content = $storage->getFile($drive, $name, $root);
|
||||
if ($content) {
|
||||
$value = base64_encode($content);
|
||||
//dd($content);
|
||||
if (mime($this->type) != 'image') {
|
||||
$root = $root . "/" . $name;
|
||||
chmod($root, 1204);
|
||||
@@ -59,7 +59,6 @@ class Ticket_attachments extends Model
|
||||
|
||||
return '<li style="background-color:#f4f4f4;"><span class="mailbox-attachment-icon has-img">'.$var.'</span><div class="mailbox-attachment-info"><b style="word-wrap: break-word;">'.$this->name.'</b><br/><p>'.$value.'</p></div></li>';
|
||||
} else {
|
||||
//$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:'.$attachment->type.';base64,' . base64_encode($data) . '"/></a>';
|
||||
$var = '<a style="max-width:200px;height:133px;color:#666;" href="'.\URL::route('image', ['image_id' => $this->id]).'" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff; font-size:18px;">'.strtoupper(str_limit($this->type, 15)).'</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">'.$this->name.'</b><br/><p>'.$value.'</p></span></div></a>';
|
||||
|
||||
return '<li style="background-color:#f4f4f4;">'.$var.'</li>';
|
||||
|
Reference in New Issue
Block a user