Skip to content

Commit

Permalink
Fix image root
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed Nov 6, 2018
1 parent 534357b commit d1d033b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions plg_fieldtypes_files/fields/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ protected function getLayoutData()
$params['filename'] = $this->filename;
$params['site_root'] = trim(Uri::root(true), '/');
$params['site_root'] .= (Factory::getApplication()->isSite()) ? '/' : '/administrator/';
$params['image_root'] = trim(Uri::root(true), '/') . '/';

Factory::getDocument()->addScriptOptions($this->id, $params);

return $data;
}
}
1 change: 1 addition & 0 deletions plg_fieldtypes_files/fields/images.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ protected function getLayoutData()
$params['limit'] = $this->limit;
$params['site_root'] = trim(Uri::root(true), '/');
$params['site_root'] .= (Factory::getApplication()->isSite()) ? '/' : '/administrator/';
$params['image_root'] = trim(Uri::root(true), '/') . '/';

Factory::getDocument()->addScriptOptions($this->id, $params);

Expand Down
6 changes: 3 additions & 3 deletions plg_fieldtypes_files/media/js/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
success: function (response) {
if (response.success) {
$(image).attr('src', params.site_root + response.data);
$(image).attr('src', params.image_root + response.data);
}
else {
$(image).attr('src', '');
Expand Down Expand Up @@ -125,7 +125,7 @@
},
success: function (response) {
if (response.success) {
$(image).attr('src', params.site_root + response.data);
$(image).attr('src', params.image_root + response.data);
}
else {
$(image).attr('src', '');
Expand Down Expand Up @@ -161,7 +161,7 @@
},
success: function (response) {
if (response.success) {
$(image).attr('src', params.site_root + response.data);
$(image).attr('src', params.image_root + response.data);
}
else {
$(image).attr('src', '');
Expand Down
2 changes: 1 addition & 1 deletion plg_fieldtypes_files/media/js/image.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d1d033b

Please sign in to comment.