solved Downloading web image directly into a media file

TiG
TiG
@tig
4 years ago
184 posts
Looking for guidance to avoid doing this any number of wrong ways.

What we would like to do is give our users the ability to fetch the contents of an article from a webpage and use same to engage in discussion. Transferring the content of the article is clear (albeit complex), but the proper way to transfer the image is not clear. Rather than have the user manually download an image to their local machine and then upload into the article using the Image SELECT button, we want to simply pull the image (from a url we have parsed from the content) and directly save the image as an appropriate media file.

The end result would be the same - an image media file properly linked to the article in Jamroom style - but the user would not even know what took place.

My question of course is how to best accomplish this in Jamroom. What is a future-safe practice for storing an image pulled from the web via a url into a Jamroom media file for ongoing use with an article (discussion or group discussion)?

Thanks.


--
TiG

updated by @tig: 06/28/20 10:13:06AM
michael
@michael
4 years ago
7,746 posts
Take a look at the jrUrlScan module, it sounds similar to what you're after. It scans text to look for URL's and if it finds one it queues it up to have that page checked for any og:tags in the page in order to get images and info out of that location. The images are then saved locally.

The function that does the getting is jrUrlScan_update_url_card() in the include.php file.
TiG
TiG
@tig
4 years ago
184 posts
Michael

jrUrlScan_save_url_image() is a perfect exemplar for what I need to build.

Thanks for saving me a ton of research time!


--
TiG
michael
@michael
4 years ago
7,746 posts
Good to hear :)

Tags