Skip to content
Snippets Groups Projects

Resolve "As a user, I want to have a page to upload and share photos so that another user can see my stories."

3 unresolved threads

Closes #72 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
10 import java.util.List;
11 @Repository
12 public class ImageRepository {
13 private final JdbcTemplate jdbcTemplate;
14
15 @Autowired
16 public ImageRepository(JdbcTemplate jdbcTemplate) {
17 this.jdbcTemplate = jdbcTemplate;
18 }
19
20
21 public int save(String url) {
22 String sql = "INSERT INTO images (url) VALUES (?)";
23 return jdbcTemplate.update(sql, url);
24 }
25 // 获取所有图片记录
  • 74 padding: 10px 20px;
    75 font-size: 1em;
    76 border-radius: 4px;
    77 cursor: pointer;
    78 transition: background-color 0.3s ease;
    79 }
    80
    81 .upload-btn:hover {
    82 background-color: #0056b3;
    83 }
    84 .carousel img {
    85 display: block; /* Ensure the image displays as a block-level element */
    86 margin: 0 auto; /* Horizontally centers the image */
    87 max-width: 100%; /* Keep image responsive */
    88 height: auto;
    89 }
  • 33 const file = event.target.files[0];
    34 if (!file) return;
    35
    36 const formData = new FormData();
    37 formData.append("image", file);
    38
    39 fetch("/api/images", {
    40 method: "POST",
    41 body: formData,
    42 })
    43 .then(response => {
    44 if (!response.ok) {
    45 throw new Error("Failed to upload image");
    46 }
    47 return response.json();
    48 })
  • It finish the uplaod pictures for the gallery and no bugs for other models

  • assigned to @c24020257

  • Zhicheng Xu assigned to @c24058946 and unassigned @c22122192

    assigned to @c24058946 and unassigned @c22122192

  • Please register or sign in to reply
    Loading