Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b1f7f367
authored
Oct 24, 2012
by
Antti Tönkyrä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image cropping fixes
adjust image aspect ratio to 0.7317073170731707
1 parent
ad84ff38
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CardPrintBean.java
code/LanBortalWeb/WebContent/user/sendPicture.xhtml
code/LanBortalWeb/WebContent/useradmin/sendPicture.xhtml
code/LanBortalWeb/WebContent/useradmin/userCartShow.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/UserCardServlet.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CardPrintBean.java
View file @
b1f7f36
...
...
@@ -103,6 +103,23 @@ public class CardPrintBean implements CardPrintBeanLocal {
.
read
(
new
ByteArrayInputStream
(
user
.
getCurrentImage
()
.
getImageData
()));
int
originalWidth
=
faceBufferedImage
.
getWidth
();
int
originalHeight
=
faceBufferedImage
.
getHeight
();
int
width
=
originalWidth
;
int
height
=
(
int
)
Math
.
round
(
originalWidth
*(
1
/
0.7317073170731707
));
if
(
height
>
originalHeight
)
{
height
=
originalHeight
;
width
=
(
int
)
Math
.
round
(
originalHeight
*
0.7317073170731707
);
}
int
offsetx
=
(
originalWidth
-
width
)/
2
;
int
offsety
=
(
originalHeight
-
height
)/
2
;
faceBufferedImage
=
faceBufferedImage
.
getSubimage
(
offsetx
,
offsety
,
width
,
height
);
Page
page
=
new
Page
(
pdf
,
new
double
[]
{
pagex
,
pagey
});
// Render background image
...
...
@@ -115,8 +132,9 @@ public class CardPrintBean implements CardPrintBeanLocal {
// Render face image
Image
faceImage
=
new
Image
(
pdf
,
convertBufferedImageToPng
(
faceBufferedImage
),
ImageType
.
PNG
);
faceImage
.
setPosition
(
15.5
,
70.0
);
faceImage
.
scaleBy
(
0.32
);
faceImage
.
setPosition
(
15.5
,
67
);
//faceImage.scaleBy(0.32);
faceImage
.
scaleBy
(((
410.0
*
0.245
)/
faceImage
.
getHeight
()));
faceImage
.
drawOn
(
page
);
// Render texts
...
...
code/LanBortalWeb/WebContent/user/sendPicture.xhtml
View file @
b1f7f36
...
...
@@ -51,7 +51,7 @@
<img
width=
"300"
src=
"#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img"
alt=
"image"
/>
<div>
<h:form>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
8
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.img"
/>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
7317073170731707
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.img"
/>
<h:commandButton
action=
"#{userView.crop()}"
value=
"#{i18n['user.cropImage']}"
/>
</h:form>
</div>
...
...
code/LanBortalWeb/WebContent/useradmin/sendPicture.xhtml
View file @
b1f7f36
...
...
@@ -52,7 +52,7 @@
<img
width=
"300"
src=
"#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.jpg"
alt=
"image"
/>
<ui:fragment
rendered=
"#{userView.canManage()}"
>
<h:form>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
8
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.jpg"
/>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
7317073170731707
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.jpg"
/>
<h:commandButton
action=
"#{userView.crop}"
value=
"#{i18n['user.cropImage']}"
/>
</h:form>
</ui:fragment>
...
...
code/LanBortalWeb/WebContent/useradmin/userCartShow.xhtml
View file @
b1f7f36
...
...
@@ -47,7 +47,7 @@
</h:form>
<h:form>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
8
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.jpg"
/>
<p:imageCropper
value=
"#{userView.croppedImage}"
aspectRatio=
"0.
7317073170731707
"
image=
"/dydata/userimage/#{userView.user.currentImage.id}.jpg"
/>
<h:commandButton
action=
"#{userView.crop}"
value=
"#{i18n['user.cropImage']}"
/>
</h:form>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/UserCardServlet.java
View file @
b1f7f36
...
...
@@ -190,7 +190,7 @@ public class UserCardServlet extends GenericImageServlet {
Image
faceImage
=
new
Image
(
pdf
,
convertBufferedImageToPng
(
faceBufferedImage
),
ImageType
.
PNG
);
faceImage
.
setPosition
(
15.5
,
70.0
);
faceImage
.
scaleBy
(
0.32
);
faceImage
.
scaleBy
(
(
410.0
/
faceImage
.
getHeight
())
);
faceImage
.
drawOn
(
page
);
// Render texts
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment