fix: media upload fails when in subdirectory with default paths
Use file['realfile'] instead of path guessing based on file['full_file'] to access image on disk, since file['full_file'] is based on the http path
This commit is contained in:
@@ -3168,9 +3168,10 @@ function serendipity_prepareMedia(&$file, $url = '') {
|
||||
$file['diskname'] = $file['name'] . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
||||
|
||||
$file['links'] = array('imagelinkurl' => $file['full_file']);
|
||||
$file['realfile'] = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
||||
|
||||
$file['dim'] = @getimagesize($file['full_thumb'], $file['thumb_header']);
|
||||
$file['dim_orig'] = @getimagesize($serendipity['serendipityPath'] . $file['full_file'], $file['header']);
|
||||
$file['dim_orig'] = @getimagesize($file['realfile'], $file['header']);
|
||||
$file['is_image'] = serendipity_isImage($file);
|
||||
|
||||
if ($file['is_image']) {
|
||||
@@ -3189,8 +3190,6 @@ function serendipity_prepareMedia(&$file, $url = '') {
|
||||
$file['mediatype'] = 'binary';
|
||||
}
|
||||
|
||||
$file['realfile'] = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
||||
|
||||
if ($full_perm || $serendipity['authorid'] == $file['authorid'] || $file['authorid'] == '0') {
|
||||
$file['is_editable'] = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user