Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9ea90caf
Commit
9ea90caf
authored
Oct 28, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added contributed 'scale', 'xscale' and 'yscale' arguments to the tag
method of Image objects.
parent
9235ee78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+18
-8
No files found.
lib/python/OFS/Image.py
View file @
9ea90caf
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Image object"""
__version__
=
'$Revision: 1.8
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
8
$'
[
11
:
-
2
]
import
Globals
,
string
,
struct
,
content_types
from
OFS.content_types
import
guess_content_type
...
...
@@ -483,29 +483,39 @@ class Image(File):
)
def
tag
(
self
,
height
=
None
,
width
=
None
,
alt
=
None
,
**
args
):
def
tag
(
self
,
height
=
None
,
width
=
None
,
alt
=
None
,
scale
=
0
,
xscale
=
0
,
yscale
=
0
,
**
args
):
"""
Generate an HTML IMG tag for this image, with customization.
Arguments to self.tag() can be any valid attributes of an IMG tag.
'src' will always be an absolute pathname, to prevent redundant
downloading of images. Defaults are applied intelligently for
'height', 'width', and 'alt'.
'height', 'width', and 'alt'. If specified, the 'scale', 'xscale',
and 'yscale' keyword arguments will be used to automatically adjust
the output height and width values of the image tag.
"""
if
height
is
None
:
height
=
self
.
height
if
width
is
None
:
width
=
self
.
width
# Auto-scaling support
xdelta
=
xscale
or
scale
ydelta
=
yscale
or
scale
if
xdelta
and
width
==
None
:
width
=
int
(
width
)
*
xdelta
if
ydelta
and
height
==
None
:
height
=
int
(
height
)
*
ydelta
string
=
'<img src="%s"'
%
(
self
.
absolute_url
())
if
alt
==
None
:
if
alt
is
None
:
alt
=
self
.
title_or_id
()
if
alt
:
string
=
'%s alt="%s"'
%
(
string
,
alt
)
if
height
==
None
:
height
=
self
.
height
if
height
:
string
=
'%s height="%s"'
%
(
string
,
height
)
if
width
==
None
:
width
=
self
.
width
if
width
:
string
=
'%s width="%s"'
%
(
string
,
width
)
...
...
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