|
| 1 | +# Media Upload |
| 2 | + |
| 3 | +The blog supports uploading media assets (images, etc.) directly to Azure Blob Storage while writing blog posts. |
| 4 | + |
| 5 | +## Configuration |
| 6 | + |
| 7 | +The following settings in `appsettings.json` control media upload functionality: |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "ImageStorageProvider": "Azure", |
| 12 | + "ImageStorage": { |
| 13 | + "AuthenticationMode": "Default", |
| 14 | + "ConnectionString": "", |
| 15 | + "ServiceUrl": "", |
| 16 | + "ContainerName": "" |
| 17 | + } |
| 18 | +} |
| 19 | +``` |
| 20 | + |
| 21 | +| Property | Type | Description | |
| 22 | +| ------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- | |
| 23 | +| ImageStorageProvider | string | Currently only supports `Azure` for Azure Blob Storage. | |
| 24 | +| AuthenticationMode | string | Authentication method - either `Default` for Microsoft Entra ID or `ConnectionString` for connection string auth | |
| 25 | +| ConnectionString | string | Azure Storage connection string (only used when AuthenticationMode is `ConnectionString`) | |
| 26 | +| ServiceUrl | string | Azure Blob Storage service URL (only used when AuthenticationMode is `Default`) | |
| 27 | +| ContainerName | string | Name of the Azure Storage container to store uploaded files. | |
| 28 | + |
| 29 | +## Authentication Methods |
| 30 | + |
| 31 | +### Default Authentication |
| 32 | +Uses Microsoft Entra ID (formerly Azure AD) managed identity or default credentials. This requires: |
| 33 | + |
| 34 | +1. Setting up proper RBAC permissions in Azure |
| 35 | +2. Configuring the ServiceUrl to point to your storage account |
| 36 | +3. No sensitive credentials needed in config |
| 37 | + |
| 38 | +### Connection String Authentication |
| 39 | +Uses a storage account connection string for authentication: |
| 40 | + |
| 41 | +1. Get connection string from Azure Portal |
| 42 | +2. Add it to the ConnectionString setting |
| 43 | +3. No additional Azure setup required |
| 44 | + |
| 45 | +## Usage |
| 46 | + |
| 47 | +1. Start writing a blog post in the markdown editor |
| 48 | +2. Drag & drop images onto the editor |
| 49 | +3. A dialog appears asking for: |
| 50 | + - File name (can include subdirectories) |
| 51 | + - Whether to enable browser caching via `Cache-Control` headers (currently set to one week) |
| 52 | +4. The image gets uploaded and a markdown image link is inserted |
| 53 | + |
| 54 | +## Performance Note |
| 55 | + |
| 56 | +Currently, the blog software serves images directly from Azure Blob Storage. For better performance and scalability, consider: |
| 57 | + |
| 58 | +- Using Azure CDN in front of the storage account |
| 59 | +- Replacing the blob storage URLs with CDN URLs |
| 60 | +- Benefits include HTTP/2 support and improved caching |
0 commit comments