Hi. I downloaded an image from outside Wordpress on the specific folder for media but it doesn't show the image on the admin panel media. What I would like to do is to write a short php code that uses wordpress to add the image from the link: wp-content/uploads/2012/07/test_image.jpg the same way that you add it from admin panel. Thank you in advance.
I try to write a php code to create posts from outside wordpress admin panel, so I need to add an image to the media library. I keep trying to figure out how but I haven't managed to find something that I want. I'm trying something like this: 1. download the image from the source website (curl) - done. now, the image is on the folder "wp-content/2012/07/" and the name of the image is image.jpg. 2. what I need now is the php code to enter this image in the media library so it can be seen from the admin panel. i know i need to create an array with the image data and insert it into the database but I don't know how. I'm not an expert in php ...
I wrote some code: include "wp-includes/plugin.php"; include "wp-admin/includes/media.php"; include "wp-admin/includes/file.php"; $file = "http://images.1channel.ch/thumbs/2135197_Rock_of_Ages_2012.jpg"; $post_id = 1; $desc = "testare upload"; media_sideload_image($file, $post_id, $desc); but I get this message: Fatal error: Call to undefined function __() in C:\xampp\htdocs\wp-admin\includes\file.php on line 11