Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
Proxy
Commits
a512ae98
Commit
a512ae98
authored
8 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
HTML5 Picture Tags werden nun unterstützt
parent
ba5d3a24
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/HtmlDocument.php
+29
-0
29 additions, 0 deletions
app/HtmlDocument.php
app/Http/Controllers/ProxyController.php
+1
-0
1 addition, 0 deletions
app/Http/Controllers/ProxyController.php
with
30 additions
and
0 deletions
app/HtmlDocument.php
+
29
−
0
View file @
a512ae98
...
...
@@ -165,6 +165,35 @@ class HtmlDocument extends Document
$img
->
setAttribute
(
"srcset"
,
$srcset
);
}
}
# All Source Tags
foreach
(
$dom
->
getElementsByTagName
(
'source'
)
as
$img
)
{
if
(
$img
->
hasAttribute
(
"src"
))
{
# Convert all Image src's to Absolute Links
$img
->
setAttribute
(
"src"
,
$this
->
convertRelativeToAbsoluteLink
(
$img
->
getAttribute
(
"src"
)));
# Convert all Image Sources to proxified Versions
$img
->
setAttribute
(
"src"
,
$this
->
proxifyUrl
(
$img
->
getAttribute
(
"src"
),
false
));
}
# Some Images might contain a srcset (Different Images for different resolutions)
# Syntax would be i.e. srcset="medium.jpg 1000w, large.jpg 2000w"
$srcset
=
$img
->
getAttribute
(
"srcset"
);
if
(
$srcset
!==
""
)
{
$images
=
explode
(
","
,
$srcset
);
foreach
(
$images
as
$index
=>
$set
)
{
$set
=
trim
(
$set
);
$parts
=
preg_split
(
"/\s+/si"
,
$set
);
# $parts[0] is the Image Path
# It could be relative so convert that one:
$parts
[
0
]
=
$this
->
convertRelativeToAbsoluteLink
(
$parts
[
0
]);
# And now Proxify it:
$parts
[
0
]
=
$this
->
proxifyUrl
(
$parts
[
0
],
false
);
$images
[
$index
]
=
implode
(
" "
,
$parts
);
}
$srcset
=
implode
(
","
,
$images
);
$img
->
setAttribute
(
"srcset"
,
$srcset
);
}
}
# Alle Meta Tags
foreach
(
$dom
->
getElementsByTagName
(
'meta'
)
as
$meta
)
{
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/ProxyController.php
+
1
−
0
View file @
a512ae98
...
...
@@ -177,6 +177,7 @@ class ProxyController extends Controller
case
'image/x-icon'
:
case
'font/eot'
:
case
'image/vnd.microsoft.icon'
:
case
'application/vnd.ms-fontobject'
:
# Nothing to do with Images: Just return them
break
;
case
'text/css'
:
...
...
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