Closed GoogleCodeExporter closed 9 years ago
i have already solved!
the error is because the facebook redirect to get the image.
you have to provide to timthumb, the final url.
Original comment by gpin...@gmail.com
on 21 Oct 2011 at 7:19
yeah, use this function to get this url.
public function getRealUrl($photoLink) {
curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->header);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, false);
curl_setopt($this->curl, CURLOPT_HEADER, false);
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($this->curl, CURLOPT_TIMEOUT, 15);
curl_setopt($this->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($this->curl, CURLOPT_URL, $photoLink);
//this assumes your code is into a class method, and uses $this->readHeader as the callback //function
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(&$this,'readHeader'));
$response = curl_exec($this->curl);
if(!curl_errno($this->curl)) {
$info = curl_getinfo($this->curl);
// var_dump($info);
if($info["http_code"] == 302) {
$headers = $this->getHeaders();
if(isset($headers['fileUrl'])) {
return $headers['fileUrl'];
}
}
}
return false;
}
Original comment by p.ba...@eminus.pl
on 24 Oct 2011 at 7:15
[deleted comment]
how to use the above code kindly explain with example.
Original comment by firdaus....@pyrspective.com
on 24 Feb 2012 at 1:29
the code in comment 2 is the best solution for this.
Original comment by BinaryMoon
on 27 Sep 2013 at 9:36
Original issue reported on code.google.com by
gpin...@gmail.com
on 21 Oct 2011 at 6:46