php - Getting Facebook Friends Picture Error -


hi have script , im having problem getting facebook friends profile picture.

"warning: imagecreatefromjpeg(array) [function.imagecreatefromjpeg]: failed open stream: no such file or directory in /home2/my1date1/public_html/judeapps/fans/img.php on line 31"

this index.php code.

        <?php session_start(); require_once 'src/facebook.php';       set_time_limit ( 120 );   $app_id = "661337633905378"; $app_secret = "958db3fad7cffbb395ae3314e069d743"; $redirect_uri = "http://apps.facebook.com/ivalentines_daysss/"; $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, 'cookie' => true )); @$code = $_request['code']; if($code) { $access_token = $facebook->getaccesstoken();  $user_id = $facebook->getuser();     $signed_request = $facebook->getsignedrequest();   $user_country = $signed_request["user"]["country"];   $country = $user_country; switch ($country)  {  case 'my': //malaysia $message = 'find out super fans here ===> http://on.fb.me/ifacebookpeekers'; break; case 'fi': //finland $message = 'selvit채 oma super fans t채ss채 ===> http://on.fb.me/ifacebookpeekers'; break; default: $message = 'find out  super fans here ===> http://on.fb.me/ifacebookpeekers'; }     //friends list    $friends = $facebook->api('/me/friends?fields=name,picture');     //array of final friends   $final_friends = array();      for($x=0;count($final_friends)<=9;$x++)     {     $rand_friend = rand(0,count($friends["data"])-1);   if(!in_array($friends["data"][$rand_friend],$final_friends))   {   $final_friends[] = $friends["data"][$rand_friend];    }  }      $image_path = 'img/'.$user_id.'.png'; //gd generated image require_once 'img.php';   $facebook->setfileuploadsupport(true);   $photo_details = array('tags'=> $tags, 'message'=> $message, 'image' => '@' . realpath($image_path) ); $upload_photo = $facebook->api('/me/photos', 'post', $photo_details);  unlink($image_path);   //for page redirection $webpage = "https://www.facebook.com/craigintimidator.mcarthu"; //redirects user after uploading picture echo "<script type='text/javascript'> location.href = '$webpage'; </script>";  } else { $url = "https://www.facebook.com/dialog/oauth?client_id=$app_id&redirect_uri=$redirect_uri&scope=read_stream,publish_stream,user_photos"; echo("<script> top.location.href='" . $url . "'</script>"); }      ?>     

and img.php code

     <?php        $dest = imagecreatefromjpeg('img/back.jpg');         //set font properties         $im = imagecreatetruecolor(220, 20);       $name_color = imagecolorallocate($im, 8,8,8);     $view_color = imagecolorallocate($im, 8,8,8);       $font = 'fonts/arial.ttf';      for($i=0,$y=170;$i<=9;$i++,$y=$y+65)   {  $rand_no1 = rand(20,50);  $rand_no2 = rand(20,60);   $friend_name = $final_friends[$i]["name"];     imagettftext( $dest, 15, 0, 360, $y, $view_color, $font, "    ".$rand_no1."                                                      ".$rand_no2."");      imagettftext( $dest, 18, 0, 80, $y, $name_color, $font, $friend_name);  }              for($i=0,$y=150;$i<=9;$i++,$y=$y+65)      {       $friend_pic = $final_friends[$i]["picture"];     $friend_pic = imagecreatefromjpeg($friend_pic);    // copy , merge imagecopymerge($dest, $friend_pic, 20, $y,0, 0, 50, 50, 100);  }    // output , free memory   imagepng($dest,$image_path,0);   ?> 


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -