Skip to content

Commit

Permalink
[fix]: Replacing ltrim by preg_replace
Browse files Browse the repository at this point in the history
  • Loading branch information
guizoxxv committed Dec 13, 2020
1 parent 2fab9f3 commit 799bdbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MultiSizeImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ private function resizeImage(
if ($outputPath) {
if ($basePath) {
// Get image dir relative to basePath
$fileDir = ltrim($img->dirname, $basePath);
$prefix = preg_quote($basePath, '/');
$fileDir = preg_replace("/^{$prefix}/", '', $img->dirname);

// Set output file path based on specified path and base path
$outputFilePath = "{$outputPath}/{$fileDir}/{$fileName}";
Expand Down

0 comments on commit 799bdbf

Please sign in to comment.