thanks, but i can’t get it to work.
wp_remote_get($imageUrl, array('headers' => 'Referer: https://mydomain.com')));
$imageurl is the url to the image.
i’m not quiet sure if it’s the header not being sent of some other issue, the origin of the issue started when a client requested that images that were hosted on his gallery would not to be visited directly, so i added some stuff to an htaccess file where the images reside:
RewriteCond %{HTTP_REFERER} !^https://(www\.)?mydomain\.com.*$ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ / [L]
which works perfectly as it should, when someone tries to visit https://mydomain.com/gallery/1.jpg they get a 404 , but if you visit https://mydomain.com and https://mydomain.com/gallery/1.jpg is linked on the page it will find the image as the referer header sent contains the mydomain.com.
The issue is the client is also using a plugin which uses the function wp_remote_get when you publish a new post and it grabs the first image it finds in the post body automatically and attaches it as a thumbnail to the post. This is what am in trying to get to work here, but even if i add the referer header it will not work, it works instantly if i remove the htaccess code.
Any ideas?
-
This reply was modified 7 years, 10 months ago by Rado.