Witam,
proszę zerknąć na stronę: http://omedia.weblance.pl/ jest to skrypt tzw stron rozrywkowych. Jedną z funkcji jest automatyczne generowanie miniaturek z youtube. Użytkownik podaje link do strony z filmem i jest tworzona miniaturka. Działa to używając funkcji fsockopen. Aby całość działała na serwerze musi myć włączona dyrektywa allow_furl_open. Nie na wszystkich jest jednak włączona. Nie mam obecnie teraz czasu zająć się tym sam, a zależy mi aby było to jak najszybciej zrobione, więc wolę to komuś zlecić. W zamian mogę zaoferować gotówkę lub skrypt oMedia (http://omedia.weblance.pl). Proszę o uczciwe propozycje cenowe, bo sam programuję i wiem, że nie ma z tym zbyt dużo roboty ;-) Prosze pisac na adres kontakt at weblance.pl

Dla zainteresowanych podaję obecny kod do przerobienia:
  1. <?php
  2. header("Content-type: image/jpeg");
  3.  
  4. $basePath = dirname(__FILE__);
  5. $configFile = $basePath.'/protected/data/settings.xml';
  6. $xmlstr = $configFile;
  7. $xml = simplexml_load_file($xmlstr);
  8.  
  9. $size=array();
  10.  
  11. foreach ($xml->children() as $var) {
  12. if ($var['id'] == 'ThumbWidth')
  13. $size[0] = $var['value'];
  14. else if ($var['id'] == 'ThumbHeight')
  15.  $size[1] = $var['value'];
  16. }
  17.  
  18. $link = $_GET['l'];
  19. $r = fsockopen('youtube.com', 80);
  20.  
  21. $out = 'GET /v/'.substr($link, strrpos($link, '=') +1 ).' HTTP/1.1'."rn";
  22. $out .= "Host: youtube.comrn";
  23. $out .= "Connection: Closernrn";
  24.  
  25. fwrite($r, $out);
  26. $buffer = '';
  27. while (!feof($r)) {
  28. $buffer .= fgets($r, 128);
  29. }
  30. fclose($r);
  31.  
  32. $m = array();
  33. preg_match('/iurl=(.*?)&t=/', $buffer, $m);
  34.  
  35. $img = imagecreatefromjpeg(urldecode($m[1]));
  36. $width = imagesx($img);
  37. $height = imagesy($img);
  38. $widthThumb = $size[0]; // szer
  39. $heightThumb = $size[1]; // wys
  40. $imgThumb = imagecreatetruecolor($widthThumb, $heightThumb);
  41. imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $widthThumb, $heightThumb, $width, $height);
  42. imagejpeg($imgThumb);
  43. imagedestroy($img);
  44. imagedestroy($imgThumb);
  45.  
  46.  
  47.  // <img src="youtube.php?l=http://youtube.com/watch?v=ZesYvP8n-DQ" />
  48. ?>