Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Team 14 - IDATT1002
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Eirik Steira
Team 14 - IDATT1002
Commits
cce4658f
Commit
cce4658f
authored
5 years ago
by
Lars Brodin Østby
Committed by
Eirik Steira
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
single image upload
parent
4a6490b9
No related branches found
Branches containing commit
No related tags found
2 merge requests
!104
Weekly merge to Master
,
!75
Single photo upload
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java
+10
-5
10 additions, 5 deletions
src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java
with
10 additions
and
5 deletions
src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java
+
10
−
5
View file @
cce4658f
...
...
@@ -126,7 +126,7 @@ public class UploadedSingle implements Initializable {
}
/**
* Method for uploading image to database with t
itle, tags and description
* Method for uploading image to database with t
ags
* Image itself is not stored but URL is
*
* @param actionEvent
...
...
@@ -135,11 +135,10 @@ public class UploadedSingle implements Initializable {
public
void
uploadSingle
(
ActionEvent
actionEvent
)
throws
IOException
{
String
tagTekst
=
photo_tag
.
toString
();
List
<
File
>
list
=
App
.
ex
.
getUploadedFiles
();
list
.
stream
().
forEach
(
x
->
{
image
=
imageService
.
createImage
(
applicationState
.
getCurrentUser
(),
x
).
get
();
List
tags
=
chopChopStringiBoi
(
tagTekst
);
List
tags
=
tagStringSplit
(
photo_tag
);
tags
.
stream
().
forEach
(
y
->
{
imageService
.
addTagToImage
(
image
,
new
Tag
((
Tag
)
y
));
});
...
...
@@ -148,8 +147,14 @@ public class UploadedSingle implements Initializable {
App
.
setRoot
(
"main"
);
}
public
List
<
String
>
chopChopStringiBoi
(
String
tagTekst
)
{
List
<
String
>
tags
=
Arrays
.
asList
(
tagTekst
.
split
(
" #"
));
/***
* Method for splitting the tag textField into tags in a list
* @param photo_tag
* @return list of string
*/
public
List
<
String
>
tagStringSplit
(
TextField
photo_tag
)
{
String
tagTekst
=
photo_tag
.
toString
();
List
<
String
>
tags
=
Arrays
.
asList
(
tagTekst
.
split
(
" #"
));
return
tags
;
}
}
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