Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- master
- claude/google-nanobanano-image-tool-011CULCaAxWF92Lzs45Tp9pm
workflow_dispatch:

permissions:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@google/generative-ai": "^0.21.0",
"jszip": "^3.10.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
30 changes: 26 additions & 4 deletions src/components/ImageGallery.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from 'react';
import JSZip from 'jszip';

export default function ImageGallery({ results, onRegenerate, onSaveAll, onRetryErrors }) {
const [selectedImage, setSelectedImage] = useState(null);
Expand All @@ -12,14 +13,35 @@ export default function ImageGallery({ results, onRegenerate, onSaveAll, onRetry
document.body.removeChild(link);
};

const saveAllImages = () => {
const saveAllImages = async () => {
const zip = new JSZip();

// Добавляем все обработанные изображения в ZIP
results.forEach((result, index) => {
if (result.result) {
setTimeout(() => {
downloadImage(result.result, `processed_${result.originalName || `image_${index}`}`);
}, index * 100);
// Извлекаем base64 данные из data URL
const base64Data = result.result.split(',')[1];
const filename = `processed_${result.originalName || `image_${index}.png`}`;

// Добавляем файл в ZIP
zip.file(filename, base64Data, { base64: true });
}
});

// Генерируем ZIP файл
const blob = await zip.generateAsync({ type: 'blob' });

// Создаем ссылку для скачивания
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = `processed_images_${Date.now()}.zip`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);

// Освобождаем память
URL.revokeObjectURL(link.href);

if (onSaveAll) onSaveAll();
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/ImageUploader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export default function ImageUploader({ onImagesLoad }) {
Перетащите изображения сюда
</p>
<p className="text-sm text-gray-500 mb-4">или</p>
<button className="px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
<span className="inline-block px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Выбрать файлы
</button>
</span>
</label>
</div>

Expand Down
Loading