Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
BRIC
dokuwiki
Commits
a02d2933
Commit
a02d2933
authored
14 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
new event and parameters for tpl_img() FS#1837 FS#1564
parent
06361442
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
inc/template.php
+27
-8
27 additions, 8 deletions
inc/template.php
with
27 additions
and
8 deletions
inc/template.php
+
27
−
8
View file @
a02d2933
...
...
@@ -916,8 +916,13 @@ function tpl_img_getTag($tags,$alt='',$src=null){
* Prints the image with a link to the full sized version
*
* Only allowed in: detail.php
*
* @param $maxwidth int - maximal width of the image
* @param $maxheight int - maximal height of the image
* @param $link bool - link to the orginal size?
* @param $params array - additional image attributes
*/
function
tpl_img
(
$maxwidth
=
0
,
$maxheight
=
0
){
function
tpl_img
(
$maxwidth
=
0
,
$maxheight
=
0
,
$link
=
true
,
$params
=
null
){
global
$IMG
;
$w
=
tpl_img_getTag
(
'File.Width'
);
$h
=
tpl_img_getTag
(
'File.Height'
);
...
...
@@ -943,12 +948,16 @@ function tpl_img($maxwidth=0,$maxheight=0){
}
//prepare URLs
$url
=
ml
(
$IMG
,
array
(
'cache'
=>
$_REQUEST
[
'cache'
]));
$src
=
ml
(
$IMG
,
array
(
'cache'
=>
$_REQUEST
[
'cache'
],
'w'
=>
$w
,
'h'
=>
$h
));
$url
=
ml
(
$IMG
,
array
(
'cache'
=>
$_REQUEST
[
'cache'
])
,
true
,
'&'
);
$src
=
ml
(
$IMG
,
array
(
'cache'
=>
$_REQUEST
[
'cache'
],
'w'
=>
$w
,
'h'
=>
$h
)
,
true
,
'&'
);
//prepare attributes
$alt
=
tpl_img_getTag
(
'Simple.Title'
);
$p
=
array
();
if
(
is_null
(
$params
)){
$p
=
array
();
}
else
{
$p
=
$params
;
}
if
(
$w
)
$p
[
'width'
]
=
$w
;
if
(
$h
)
$p
[
'height'
]
=
$h
;
$p
[
'class'
]
=
'img_detail'
;
...
...
@@ -958,11 +967,21 @@ function tpl_img($maxwidth=0,$maxheight=0){
}
else
{
$p
[
'alt'
]
=
''
;
}
$p
=
buildAttributes
(
$p
);
$p
[
'src'
]
=
$src
;
$data
=
array
(
'url'
=>
(
$link
?
$url
:
null
),
'params'
=>
$p
);
return
trigger_event
(
'TPL_IMG_DISPLAY'
,
$data
,
'_tpl_img_action'
,
true
);
}
/**
* Default action for TPL_IMG_DISPLAY
*/
function
_tpl_img_action
(
$data
,
$param
=
NULL
)
{
$p
=
buildAttributes
(
$data
[
'params'
]);
print
'<a href="'
.
$url
.
'">'
;
print
'<img
src="'
.
$src
.
'"
'
.
$p
.
'/>'
;
print
'</a>'
;
if
(
$data
[
'url'
])
print
'<a href="'
.
hsc
(
$data
[
'url'
])
.
'">'
;
print
'<img '
.
$p
.
'/>'
;
if
(
$data
[
'url'
])
print
'</a>'
;
return
true
;
}
...
...
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