10 Commits
Author SHA1 Message Date
solidlime 21bb26d72f feat: store temp image reference instead of base64 in workflow
File picker previously embedded base64 image data in the image_data widget, bloating workflow JSON past the 5MiB localStorage limit (Failed to save workflow draft). Now uploads via POST /upload/image with type=temp and stores a small '<path> [temp]' reference; backend resolves it with get_annotated_filepath. Base64 data URLs from older saves still load via backward-compat path.
2026-08-02 09:02:02 +09:00
solidlime 3a2c2419c4 UI: Completely hide image_data and add instant preview
Changes:
1. Complete widget hiding:
   - Added .hidden = true
   - Added setTimeout for reliability
   - Added serializeValue to preserve data

2. Instant preview on file load:
   - Create Image object from base64
   - Set node.imgs for preview display
   - Call setSizeForImage() and setDirtyCanvas()
   - Preview shows immediately without execution

Now has clean UI and instant visual feedback!
2026-01-07 22:06:30 +09:00
solidlime 7e05de431b UI: Hide image_data widget for cleaner appearance
Added JavaScript to hide the image_data widget:
- Set type to 'converted-widget'
- Set computeSize to [0, -4] to hide it

The widget still functions (auto-filled by file picker)
but is no longer visible in the UI for cleaner look.
2026-01-07 22:02:43 +09:00
solidlime 12cd33bbc8 Fix: Make image_data a visible widget and remove alert messages
Changes:
- Moved image_data from optional to required (no forceInput)
- image_data is now a multiline STRING widget (auto-filled by file picker)
- Removed alert() and console.log() messages
- Store base64 data in both node.properties and widget.value

This fixes the 'object supporting the buffer API required' error
by ensuring image_data widget exists and can be set by JavaScript.
2026-01-07 21:37:33 +09:00
solidlime b5f185447d Refactor: Strict folder_mode-based logic with auto-switch
Changes:
- folder_mode=True: Always use folder_path for random selection
- folder_mode=False: Always use file picker (image_data)
- Auto-switch: File picker automatically sets folder_mode=False

Behavior:
- User clicks 📁 Choose File → auto-switches to Single mode
- folder_mode toggle explicitly controls which input to use
- No more auto-detection ambiguity
- Clear separation between modes

Benefits:
- Predictable behavior based on folder_mode setting
- File picker prioritized by auto-switching to Single mode
- User can maintain folder_path while using file picker
- Cleaner error messages for each mode
2026-01-07 21:31:15 +09:00
solidlime bd275c4941 Major redesign: Direct file reading for single mode
Breaking changes:
- Single mode: Now uses file picker with direct browser-based image reading
- Folder mode: Uses manual path input only
- Renamed 'image' parameter to 'folder_path' for clarity
- Added 'image_data' optional parameter for base64 image data

Implementation:
- JavaScript: FileReader API to read image as base64
- Python: Decode base64 and convert to tensor (no file system access needed)
- Better UX: No confusing error messages about missing paths
- Clear separation: File picker for single, text input for folder

Benefits:
- Single mode works without file system paths
- No browser security issues
- Cleaner user experience
- Explicit mode separation
2026-01-07 21:21:19 +09:00
solidlime f453a4fe47 Improve user guidance for file path input
Changes:
- Added tooltips to all input parameters explaining their purpose
- Enhanced alert dialog with detailed instructions and examples
- Shows current default path in the alert
- Better formatting for multi-line instructions
- Added dynamicPrompts: false to image input for better UX

Note: Browser security prevents automatic full path detection.
Users need to manually enter the complete file path after using the file picker.
2026-01-07 21:12:14 +09:00
solidlime f7284990ed Fix: Add WEB_DIRECTORY and simplify JavaScript widget
Critical fixes:
- Added WEB_DIRECTORY = './web' to __init__.py (REQUIRED for ComfyUI to load JS)
- Simplified JavaScript implementation based on working custom nodes
- Removed unnecessary imports (ComfyWidgets)
- Cleaner button implementation that actually registers

This should now properly load the JavaScript widget when ComfyUI starts.
2026-01-07 21:04:57 +09:00
solidlime aef43bd2f8 Refactor: Simplify file picker and auto-extract folder path
Major changes:
- Changed input parameter from 'path' to 'image' for clarity
- Auto-extract folder path from file selection in folder mode
- Simplified JavaScript widget implementation
- Added OUTPUT_IS_LIST flag for proper output handling
- Improved file selection UI with emoji icons
- Added helpful info widget explaining the modes

Features:
- Single mode: Load selected file directly
- Folder mode: Extract folder from selected file, then pick random image
- Better user feedback with console logging
- More robust path handling (file or directory input)
2026-01-07 20:59:15 +09:00
solidlime a990101377 Add preview and file browser features
Features:
- Added OUTPUT_NODE for real-time image preview
- Implemented Browse button with JavaScript widget
- Enhanced path input with placeholder and default value
- Updated README with new feature documentation

Changes:
- random_image_picker.py: Added OUTPUT_NODE, improved INPUT_TYPES
- web/random_image_picker.js: New custom widget for file/folder selection
- README.md: Updated documentation with new features
- .gitignore: Added web directory ignore patterns
2026-01-07 20:49:47 +09:00