Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tiny Tiny RSS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Server
Tiny Tiny RSS
Commits
0442cbb6
Commit
0442cbb6
authored
Feb 04, 2017
by
Andrew Dolgov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image cache: send files as content-disposition: attachment; add .png suffix to image urls
parent
60e97d9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
classes/handler/public.php
classes/handler/public.php
+3
-1
include/functions2.php
include/functions2.php
+15
-14
No files found.
classes/handler/public.php
View file @
0442cbb6
...
...
@@ -1051,9 +1051,11 @@ class Handler_Public extends Handler {
if
(
$hash
)
{
$filename
=
CACHE_DIR
.
'/images/'
.
$hash
.
'.png'
;
$filename
=
CACHE_DIR
.
'/images/'
.
$hash
;
if
(
file_exists
(
$filename
))
{
header
(
"Content-Disposition: attachment; filename=
\"
"
.
basename
(
$filename
)
.
"
\"
"
);
/* See if we can use X-Sendfile */
$xsendfile
=
false
;
if
(
function_exists
(
'apache_get_modules'
)
&&
...
...
include/functions2.php
View file @
0442cbb6
...
...
@@ -903,27 +903,28 @@
$entry
->
setAttribute
(
'rel'
,
'noopener noreferrer'
);
}
if
(
$entry
->
hasAttribute
(
'src'
))
{
$src
=
rewrite_relative_url
(
$site_url
,
$entry
->
getAttribute
(
'src'
));
if
(
$entry
->
nodeName
==
'img'
)
{
if
(
$entry
->
hasAttribute
(
'src'
))
{
$src
=
rewrite_relative_url
(
$site_url
,
$entry
->
getAttribute
(
'src'
));
$cached_filename
=
CACHE_DIR
.
'/images/'
.
sha1
(
$src
)
.
'.png'
;
$cached_filename
=
CACHE_DIR
.
'/images/'
.
sha1
(
$src
)
.
'.png'
;
if
(
file_exists
(
$cached_filename
))
{
$src
=
SELF_URL_PATH
.
'/public.php?op=cached_image&hash='
.
sha1
(
$src
)
;
if
(
file_exists
(
$cached_filename
))
{
$src
=
SELF_URL_PATH
.
'/public.php?op=cached_image&hash='
.
sha1
(
$src
)
.
'.png'
;
if
(
$entry
->
hasAttribute
(
'srcset'
))
{
$entry
->
removeAttribute
(
'srcset'
);
}
if
(
$entry
->
hasAttribute
(
'srcset'
))
{
$entry
->
removeAttribute
(
'srcset'
);
}
if
(
$entry
->
hasAttribute
(
'sizes'
))
{
$entry
->
removeAttribute
(
'sizes'
);
if
(
$entry
->
hasAttribute
(
'sizes'
))
{
$entry
->
removeAttribute
(
'sizes'
);
}
}
}
$entry
->
setAttribute
(
'src'
,
$src
);
}
$entry
->
setAttribute
(
'src'
,
$src
);
}
if
(
$entry
->
nodeName
==
'img'
)
{
if
(
$entry
->
hasAttribute
(
'src'
))
{
$is_https_url
=
parse_url
(
$entry
->
getAttribute
(
'src'
),
PHP_URL_SCHEME
)
===
'https'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment