Skip to content

[InstagramBridge] Serve img as base64 data#4908

Open
zenphonix wants to merge 7 commits into
RSS-Bridge:masterfrom
zenphonix:instagram_img
Open

[InstagramBridge] Serve img as base64 data#4908
zenphonix wants to merge 7 commits into
RSS-Bridge:masterfrom
zenphonix:instagram_img

Conversation

@zenphonix

Copy link
Copy Markdown

Because of instagrams restrictive CORS same-origin policy images are not rendered when referenced directly.

This PR introduces fetching the image and serving it as base64 encoded data.

Fixes #2005

@github-actions

github-actions Bot commented Feb 21, 2026

Copy link
Copy Markdown

Pull request artifacts

Bridge Context Status
Instagram 1 Username (current) ✔️
Instagram 1 Username (pr) ✔️
Instagram 2 Hashtag (current) Bridge returned error 401! (20509)
Type: HttpException
Message: https://www.instagram.com/graphql/query/?query_hash=9b498c08113f1e09617a1703c22b2f32&variables={"tag_name"%3A"beautifulday"%2C"first"%3A10} resulted in 401 Unauthorized
Instagram 2 Hashtag (pr) Bridge returned error 401! (20509)
Type: HttpException
Message: https://www.instagram.com/graphql/query/?query_hash=9b498c08113f1e09617a1703c22b2f32&variables={"tag_name"%3A"beautifulday"%2C"first"%3A10} resulted in 401 Unauthorized
Instagram 3 Location (current) ⚠️ The feed has no items
Instagram 3 Location (pr) ⚠️ The feed has no items

last change: Wednesday 2026-02-25 13:50:40

@zenphonix

Copy link
Copy Markdown
Author

It would be good to downscale the images to 540x540 to improve loading times

@zenphonix

Copy link
Copy Markdown
Author

One quick way to resize images would be

$imageSmall = imagescale($image,540);

but this would require PHP GD library. Is it feasible to include GD in into rss-bridge?
I could imagine that other bridges might benefit from GD as well.

@zenphonix zenphonix changed the title Serve img as base64 data [InstagramBridge] Serve img as base64 data Feb 21, 2026
@zenphonix

Copy link
Copy Markdown
Author

Last two commits include these changes:

  • add php-gd installation to dockerfile
  • rescale instagram images to 540pt (50%) before encoding as data:image/png;base64

@zenphonix

Copy link
Copy Markdown
Author

Need to add a conditional test in order to avoid exception

imagescale(): Argument #1 ($image) must be of type GdImage, bool given

* Add condition and unset variables
* Add image resolution box
* Add function getResolution
@dvikan

dvikan commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

im not 100% this code is secure. so im unconformable merging,

in the very least, file_get_contents is forbidden

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instagram images are not loaded

2 participants