Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_youtube
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_youtube
Commits
c1d466f8
Commit
c1d466f8
authored
2 years ago
by
Stefan Galinski
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] Fix warnings if the external URL download isn't working for the cached image service
parent
6a50d12d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Service/CachedImageService.php
+12
-10
12 additions, 10 deletions
Classes/Service/CachedImageService.php
with
12 additions
and
10 deletions
Classes/Service/CachedImageService.php
+
12
−
10
View file @
c1d466f8
...
...
@@ -119,22 +119,24 @@ class CachedImageService {
$imageHash
=
\md5
(
$url
);
// check if any kind of image with this hash is already in the cache-directory
$cachedImage
=
\glob
(
$cachedImageFolderPath
.
$imageHash
.
'.*'
);
$cachedFileWebPath
=
''
;
if
(
count
(
$cachedImage
)
<=
0
)
{
// if the cache-directory has not been created yet, do so
GeneralUtility
::
mkdir_deep
(
$cachedImageFolderPath
);
// copy without file extension for now
\copy
(
$url
,
$cachedImageFolderPath
.
$imageHash
);
$imageType
=
\exif_imagetype
(
$cachedImageFolderPath
.
$imageHash
);
if
(
@
\copy
(
$url
,
$cachedImageFolderPath
.
$imageHash
))
{
// copy without file extension for now
$imageType
=
\exif_imagetype
(
$cachedImageFolderPath
.
$imageHash
);
// figure out the file extension based on the image's mime-type
$cachedFileName
=
$imageHash
.
\image_type_to_extension
(
$imageType
);
$cachedFilePath
=
$cachedImageFolderPath
.
$cachedFileName
;
// figure out the file extension based on the image's mime-type
$cachedFileName
=
$imageHash
.
\image_type_to_extension
(
$imageType
);
$cachedFilePath
=
$cachedImageFolderPath
.
$cachedFileName
;
// correct name
\rename
(
$cachedImageFolderPath
.
$imageHash
,
$cachedFilePath
);
GeneralUtility
::
fixPermissions
(
$cachedFilePath
);
$cachedFileWebPath
=
PathUtility
::
getAbsoluteWebPath
(
$cachedFilePath
);
// correct name
\rename
(
$cachedImageFolderPath
.
$imageHash
,
$cachedFilePath
);
GeneralUtility
::
fixPermissions
(
$cachedFilePath
);
$cachedFileWebPath
=
PathUtility
::
getAbsoluteWebPath
(
$cachedFilePath
);
}
}
else
{
$cachedFileWebPath
=
PathUtility
::
getAbsoluteWebPath
(
$cachedImage
[
0
]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment