... |
... |
@@ -1,8 +1,22 @@ |
1 |
1 |
{{groovy}} |
2 |
|
- |
3 |
3 |
// Nom de l'image en pièce jointe |
4 |
|
-def attachmentName = 'image.gif' |
|
3 |
+def attachmentName = 'NGIZero_logo.png' |
5 |
5 |
|
|
5 |
+// Récupérer l'image en pièce jointe |
|
6 |
+def img = doc.getAttachment(attachmentName) |
6 |
6 |
|
|
8 |
+if (img != null) { |
|
9 |
+ def outs = response.outputStream |
|
10 |
+ response.setContentType("image/png") |
|
11 |
+ |
|
12 |
+ // Récupérer le contenu de l'image |
|
13 |
+ def imgBytes = img.getContent() |
|
14 |
+ |
|
15 |
+ // Écrire les bytes dans le flux de sortie |
|
16 |
+ outs.write(imgBytes) |
|
17 |
+ outs.close() |
|
18 |
+} else { |
|
19 |
+ response.sendError(404, "L'image n'existe pas.") |
|
20 |
+} |
7 |
7 |
{{/groovy}} |
8 |
8 |
|