private function readUrl_Curl($url, $destFile, ImThumb $requestor)
 {
     self::$curlFH = @fopen($destFile, 'w');
     if (!self::$curlFH) {
         throw new ImThumbException('Could not open cache file for remote image', ImThumb::ERR_CACHE);
     }
     self::$curlDataWritten = 0;
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_TIMEOUT, $requestor->param('externalRequestTimeout'));
     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30");
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($curl, CURLOPT_HEADER, 0);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($curl, CURLOPT_WRITEFUNCTION, 'ImThumbSource_HTTP::curlWrite');
     @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
     @curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
     $curlResult = curl_exec($curl);
     $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     fclose(self::$curlFH);
     curl_close($curl);
     if ($httpStatus == 404) {
         throw new ImThumbNotFoundException('Could not locate remote image', ImThumb::ERR_SRC_IMAGE);
     }
     if ($httpStatus == 302) {
         throw new ImThumbNotFoundException("External Image is Redirecting. Try alternate image url", ImThumb::ERR_SRC_IMAGE);
     }
     if (!$curlResult) {
         throw new ImThumbException("Internal cURL error fetching remote file", ImThumb::ERR_SRC_IMAGE);
     }
 }
 public function readMetadata($src, ImThumb $requestor)
 {
     preg_match('/(\\?|&)v=(\\w+)(\\W|$)/', $src, $matches);
     $src = 'http://img.youtube.com/vi/' . $matches[2] . '/0.jpg';
     return parent::readMetadata($src, $requestor);
 }