Skip to content

Instantly share code, notes, and snippets.

@xwero
Last active October 11, 2025 07:50
Show Gist options
  • Select an option

  • Save xwero/f2de7cef0a0576687fd8824fc6d74837 to your computer and use it in GitHub Desktop.

Select an option

Save xwero/f2de7cef0a0576687fd8824fc6d74837 to your computer and use it in GitHub Desktop.
LLM image gallery generator first prompt output
Create a CLI command image-gallery, that runs PHP code, that accepts a directory as an argument.
The command searches for all jpegs in the directory and extracts the EXIF information.
Once that is done it creates a child directory named web, and an index.html page from a template.
The template contains the images that are sorted by the timestamp in the EXIF information. The images are tumbnails and by clicking on them a dialog, use the dialog tag, should open to see a preview image. The template should also contain a link to a zip file with the name of the directory that is stored in the web directory.
After creating the index.html file create the tumbnail and preview images base on the aspect ratio that is found in de EXIF information. The thumbnails should be maximum 200 pixels in height and the preview images should be maximum 1000 pixels in height.
Also create the zip file with the name of the directory in the web directory.
The creating of the images and zip file should be done in parallel.
When something goes wrong with the creation of the directory or files rollback the changes and show a thumbs down emoji. When everything is successful show a thumbs up emoji.
Use best practices like not using globals.
Only generate the code and template.
I'm using duck.ai with the GPT-OSS 120B model. I added an extra prompt to not use classes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Gallery</title>
<style>
body {font-family: Arial, sans-serif; margin: 20px;}
.gallery {display: flex; flex-wrap: wrap; gap: 12px;}
.thumb img {height: 200px; cursor: pointer; border: 1px solid #ccc;}
dialog {border: none; border-radius: 8px; max-width: 90vw; max-height: 90vh;}
dialog img {max-height: 80vh; max-width: 100%;}
dialog::backdrop {background: rgba(0,0,0,0.6);}
.close-btn {position: absolute; top: 8px; right: 12px; background: transparent;
border: none; font-size: 1.5rem; cursor: pointer; color: #fff;}
</style>
</head>
<body>
<h1>Image Gallery</h1>
<a href="{{ZIP_LINK}}" download>Download ZIP</a>
<div class="gallery">
{{GALLERY}}
</div>
<!-- Dialog element reused for every preview -->
<dialog id="previewDialog">
<button class="close-btn" id="closeDialog">&times;</button>
<img id="previewImg" src="" alt="Preview">
</dialog>
<script>
const dialog = document.getElementById('previewDialog');
const previewImg = document.getElementById('previewImg');
const closeBtn = document.getElementById('closeDialog');
document.querySelectorAll('.thumb img').forEach(img => {
img.addEventListener('click', () => {
previewImg.src = img.dataset.preview;
dialog.showModal();
});
});
closeBtn.addEventListener('click', () => dialog.close());
dialog.addEventListener('click', e => {
if (e.target === dialog) dialog.close();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment