Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.3-develop' into 5.3-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
brookgagnon committed Sep 12, 2024
2 parents 23f2702 + 33ce20a commit cce768d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion classes/core/obfhelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,24 @@ public static function image_resize($src, $dst, $width, $height)
trigger_error('The source file does not exist', E_USER_WARNING);
return false;
}
if (!is_writeable(pathinfo($dst)['dirname'])) {

// get destination directory and create if it doesn't exist
$dst_pathinfo = pathinfo($dst);
if (!is_dir($dst_pathinfo['dirname'])) {
mkdir($dst_pathinfo['dirname'], 0777, true);
echo $dst_pathinfo['dirname'];
}

// make sure it exists now
if (!is_dir($dst_pathinfo['dirname'])) {
echo 'foo';
trigger_error('Unable to create destination directory.', E_USER_WARNING);
return false;
}

// and we can write to it
if (!is_writeable($dst_pathinfo['dirname'])) {
echo 'bar';
trigger_error('The destination directory is not writeable', E_USER_WARNING);
return false;
}
Expand Down

0 comments on commit cce768d

Please sign in to comment.