added image proxy

This commit is contained in:
partisan 2024-04-05 14:15:43 +02:00
parent 33dbefcf6e
commit 8da8999802
5 changed files with 101 additions and 16 deletions

View file

@ -69,11 +69,11 @@ func fetchImageResults(query string) ([]ImageSearchResult, error) {
var results []ImageSearchResult
for _, item := range apiResp.Data.Result.Items {
results = append(results, ImageSearchResult{
Thumbnail: item.Thumbnail, // Thumbnail URL
Title: item.Title, // Image title
Media: item.Media, // Direct link to the image - Ensure this field is used appropriately in your template
Source: item.Media, // Using item.Media here ensures the direct image link is used
ThumbProxy: "/img_proxy?url=" + url.QueryEscape(item.Thumbnail), // Proxy URL for the thumbnail, if needed
Thumbnail: item.Thumbnail, // Thumbnail URL
Title: item.Title, // Image title
Media: item.Media, // Direct link to the image - Ensure this field is used appropriately in your template
Source: item.Media, // Using item.Media here ensures the direct image link is used
ThumbProxy: "/img_proxy?url=" + url.QueryEscape(item.Media), // Proxy URL for the thumbnail, if needed
Width: item.Width,
Height: item.Height,
})