Public
Like
Imagetourl
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
image-host.ts
https://dcm31--44435b2832a811f08f06569c3dd06744.web.val.run
This is a web application and API that allows you to host images in Val Town's blob storage, either by providing a URL or uploading directly from your device.
- Multiple Upload Methods:
- Upload images from a URL
- Upload images directly from your device
- API Access:
- RESTful API for programmatic image hosting
- Comprehensive API documentation
- Image Management:
- Permanent storage in Val Town's blob storage
- Unique URLs for each hosted image
- Image metadata retrieval
- Upload an Image:
- Provide a URL to an existing image, OR
- Upload an image file from your device
- Storage:
- The image is downloaded/processed and stored in Val Town's blob storage with a unique key
- Access:
- A permanent URL is generated for accessing the image
- The image can be embedded in websites, shared, or accessed via API
Upload an image from a URL.
Request Body (JSON):
{ "url": "https://example.com/image.jpg" }
Response (Success):
{ "success": true, "key": "img_1234567890_abc123.jpg", "url": "https://your-val-town-url.com/view?key=img_1234567890_abc123.jpg", "contentType": "image/jpeg" }
Get information about a hosted image.
Query Parameters:
key
- The unique key of the image
Response (Success):
{ "success": true, "key": "img_1234567890_abc123.jpg", "contentType": "image/jpeg", "size": 12345, "url": "https://your-val-town-url.com/view?key=img_1234567890_abc123.jpg" }
Retrieve and display a hosted image.
Query Parameters:
key
- The unique key of the image
Response: The image with the appropriate content type.
- Built using Val Town's HTTP endpoints
- Uses Val Town's blob storage for image persistence
- Handles various image formats (JPEG, PNG, GIF, WebP, SVG, BMP)
- Preserves the original content type of the image
- Only works with publicly accessible image URLs for URL-based uploads
- There may be size limitations based on Val Town's blob storage constraints
- Only supports common image formats (JPEG, PNG, GIF, WebP, SVG, BMP)