Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
ARSnova Backend
Commits
9690b52a
Commit
9690b52a
authored
10 years ago
by
Jan Sladek
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation for the Utility-Methods in ImageUtils.java for ticket #15324.
parent
e8fcd2fd
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/thm/arsnova/ImageUtils.java
+17
-1
17 additions, 1 deletion
src/main/java/de/thm/arsnova/ImageUtils.java
with
17 additions
and
1 deletion
src/main/java/de/thm/arsnova/ImageUtils.java
+
17
−
1
View file @
9690b52a
...
...
@@ -45,6 +45,10 @@ public class ImageUtils {
// Or whatever size you want to read in at a time.
private
static
final
int
CHUNK_SIZE
=
4096
;
/**
* {@link Pattern} used to check if a {@link String} starts with the
* Base64-Mimetype Prefix and to extract information from the {@link String}.
*/
public
static
final
Pattern
BASE64_IMAGE_PREFIX_PATTERN
=
Pattern
.
compile
(
"data:image/(.*);base64,(.*)"
);
...
...
@@ -81,7 +85,7 @@ public class ImageUtils {
}
/**
* Checks if a String starts with the
b
ase
64 prefix.
* Checks if a
{@link
String
}
starts with the
B
ase64
-Mimetype
prefix.
*
* @param maybeImage The Image as a base64 encoded {@link String}
* @return true if the string is a potentially a base 64 encoded image.
...
...
@@ -97,6 +101,18 @@ public class ImageUtils {
return
BASE64_IMAGE_PREFIX_PATTERN
.
matcher
(
maybeImage
).
matches
();
}
/**
* Rescales an image represented by a Base64-encoded {@link String}
*
* @param originalImageString
* The original image represented by a Base64-encoded
* {@link String}
* @param width
* the new width
* @param height
* the new height
* @return The rescaled Image as Base64-encoded {@link String}
*/
public
static
String
rescaleImage
(
String
originalImageString
,
final
int
width
,
final
int
height
)
{
if
(!
isBase64EncodedImage
(
originalImageString
))
return
null
;
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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