|
13 | 13 | font-family: "IBM Plex Sans", sans-serif; |
14 | 14 | max-width: 800px; |
15 | 15 | margin: 0 auto; |
16 | | - padding: 80px 20px 20px; |
| 16 | + padding: 50px 20px 20px; |
17 | 17 | background-color: #f5f5f5; |
18 | 18 | } |
19 | 19 |
|
|
34 | 34 | width: 100%; |
35 | 35 | padding: 10px; |
36 | 36 | font-size: 16px; |
| 37 | + font-family: inherit; |
37 | 38 | border: 2px solid #ddd; |
38 | 39 | border-radius: 8px; |
39 | 40 | box-sizing: border-box; |
|
45 | 46 | border-color: #4caf50; |
46 | 47 | } |
47 | 48 |
|
| 49 | + a { |
| 50 | + text-decoration: none; |
| 51 | + } |
| 52 | + |
| 53 | + a, |
48 | 54 | button { |
49 | 55 | background-color: #4caf50; |
50 | 56 | color: white; |
51 | 57 | padding: 15px 30px; |
52 | 58 | font-size: 16px; |
| 59 | + font-family: inherit; |
53 | 60 | border: none; |
54 | 61 | border-radius: 8px; |
55 | 62 | cursor: pointer; |
|
84 | 91 |
|
85 | 92 | .generated-image { |
86 | 93 | max-width: 100%; |
| 94 | + max-height: 600px; |
87 | 95 | height: auto; |
88 | 96 | border-radius: 10px; |
89 | 97 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); |
@@ -134,7 +142,7 @@ <h1>Image Generator</h1> |
134 | 142 | alt="Generated image" |
135 | 143 | /> |
136 | 144 | <br /><br /> |
137 | | - <button class="clear-btn" onclick="clearImage()">Clear</button> |
| 145 | + <a href="/" class="clear-btn" onclick="clearImage()">Clear</a> |
138 | 146 | </div> |
139 | 147 | </div> |
140 | 148 |
|
@@ -176,9 +184,9 @@ <h1>Image Generator</h1> |
176 | 184 | throw new Error(`HTTP error! status: ${response.status}`); |
177 | 185 | } |
178 | 186 |
|
179 | | - const { imageUrl } = await response.json(); |
| 187 | + const { nextUrl } = await response.json(); |
180 | 188 |
|
181 | | - showImage(imageUrl); |
| 189 | + window.location.href = nextUrl; |
182 | 190 | } catch (error) { |
183 | 191 | console.error("Error generating image:", error); |
184 | 192 | showError("Failed to generate image. Please try again."); |
@@ -207,15 +215,13 @@ <h1>Image Generator</h1> |
207 | 215 | promptSection.classList.remove("hidden"); |
208 | 216 | } |
209 | 217 |
|
210 | | - function clearImage() { |
211 | | - imageSection.classList.add("hidden"); |
212 | | - errorSection.classList.add("hidden"); |
213 | | - promptSection.classList.remove("hidden"); |
214 | | - promptInput.value = ""; |
215 | | - promptInput.focus(); |
| 218 | + const path = window.location.pathname; |
| 219 | + const imageMatch = path.match(/^\/display\/(.+\.jpg)$/); |
216 | 220 |
|
217 | | - // Clean up the blob URL |
218 | | - URL.revokeObjectURL(generatedImage.src); |
| 221 | + if (imageMatch) { |
| 222 | + const imageUrl = `/static/${imageMatch[1]}`; |
| 223 | + showLoading(); |
| 224 | + showImage(imageUrl); |
219 | 225 | } |
220 | 226 | </script> |
221 | 227 | </body> |
|
0 commit comments