From 3271d165ff48fdeb82014c9bdf481c1b7a185353 Mon Sep 17 00:00:00 2001 From: Mikael Roos Date: Mon, 7 Dec 2015 10:09:26 +0100 Subject: [PATCH] add correct version to remote headers, fix #131 --- CRemoteImage.php | 7 ++++++- webroot/img.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CRemoteImage.php b/CRemoteImage.php index c081cb3..4eb418e 100644 --- a/CRemoteImage.php +++ b/CRemoteImage.php @@ -147,7 +147,12 @@ class CRemoteImage */ public function setHeaderFields() { - $this->http->setHeader("User-Agent", "CImage/0.7.2 (PHP/". phpversion() . " cURL)"); + $cimageVersion = "CImage"; + if (defined("CIMAGE_USER_AGENT")) { + $cimageVersion = CIMAGE_USER_AGENT; + } + + $this->http->setHeader("User-Agent", "$cimageVersion (PHP/". phpversion() . " cURL)"); $this->http->setHeader("Accept", "image/jpeg,image/png,image/gif"); if ($this->useCache) { diff --git a/webroot/img.php b/webroot/img.php index 4ac8106..be3004f 100644 --- a/webroot/img.php +++ b/webroot/img.php @@ -10,6 +10,9 @@ $version = "v0.7.8* (2015-12-06)"; +// For CRemoteImage +define(CIMAGE_USER_AGENT, "CImage/$version"); + /**