Skip to content

Instantly share code, notes, and snippets.

View g3luka's full-sized avatar

Giovanni de Luca g3luka

View GitHub Profile
@RadGH
RadGH / rs_upload_from_url.php
Last active March 10, 2025 21:21
Upload a file from a URL to the WordPress media gallery. Supports images, PDFs, and other file types.
<?php
/**
* This function uploads a file from a URL to the media library, designed to be placed in your own theme or plugin.
* Metadata will be generated and images will generate thumbnails automatically.
*
* HOW TO USE:
* 1. Add the function below to your theme or plugin
* 2. Call the function and provide the URL to an image or other file.
* 3. If successful, the attachment ID will be returned.
Updated 2025-01-17 thanks to Yemster's comment.
This should work on any architecture of Amazon Linux 2.
(_Although not tested , should also work for Amazon Linux 2023_).
**Prereq**
- visit https://johnvansickle.com/ffmpeg/ to grab the link to the relevant tarball for your specific server architecture.
- Use `uname -a` to find out your arch if unknown
### TL;DR
@dbisso
dbisso / 10_blackfire_repo.config
Last active February 1, 2023 15:12
Set up Blackfire on AWS Elastic Beanstalk
commands:
01_add_blackfire_repo:
command: "sudo yum install -y pygpgme && wget -O - 'http://packages.blackfire.io/fedora/blackfire.repo' | sudo tee /etc/yum.repos.d/blackfire.repo"