Resolve "As a user, I want to have a page to upload and share photos so that another user can see my stories."
Merged
requested to merge 72-as-a-user-i-want-to-have-a-page-to-upload-and-share-photos-so-that-another-user-can-see-my into main
3 unresolved threads
Closes #72 (closed)
Merge request reports
Activity
Filter activity
changed milestone to %Sprint4
requested review from @c24020257
assigned to @c22122192
mentioned in commit 4f85fb18
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 // 获取所有图片记录 - src/main/resources/static/css/gallery.css 0 → 100644
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 } - src/main/resources/static/js/gallery.js 0 → 100644
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 }) assigned to @c24020257
assigned to @c24058946 and unassigned @c22122192