<i id='yCoyf'><tr id='yCoyf'><dt id='yCoyf'><q id='yCoyf'><span id='yCoyf'><b id='yCoyf'><form id='yCoyf'><ins id='yCoyf'></ins><ul id='yCoyf'></ul><sub id='yCoyf'></sub></form><legend id='yCoyf'></legend><bdo id='yCoyf'><pre id='yCoyf'><center id='yCoyf'></center></pre></bdo></b><th id='yCoyf'></th></span></q></dt></tr></i><div id='yCoyf'><tfoot id='yCoyf'></tfoot><dl id='yCoyf'><fieldset id='yCoyf'></fieldset></dl></div>
    <bdo id='yCoyf'></bdo><ul id='yCoyf'></ul>

      <small id='yCoyf'></small><noframes id='yCoyf'>

      <legend id='yCoyf'><style id='yCoyf'><dir id='yCoyf'><q id='yCoyf'></q></dir></style></legend>

      1. <tfoot id='yCoyf'></tfoot>

      2. 上传 facebook 事件图片引发错误

        时间:2023-05-30
          <i id='5HJnY'><tr id='5HJnY'><dt id='5HJnY'><q id='5HJnY'><span id='5HJnY'><b id='5HJnY'><form id='5HJnY'><ins id='5HJnY'></ins><ul id='5HJnY'></ul><sub id='5HJnY'></sub></form><legend id='5HJnY'></legend><bdo id='5HJnY'><pre id='5HJnY'><center id='5HJnY'></center></pre></bdo></b><th id='5HJnY'></th></span></q></dt></tr></i><div id='5HJnY'><tfoot id='5HJnY'></tfoot><dl id='5HJnY'><fieldset id='5HJnY'></fieldset></dl></div>
        1. <tfoot id='5HJnY'></tfoot>
                  <bdo id='5HJnY'></bdo><ul id='5HJnY'></ul>

                  <legend id='5HJnY'><style id='5HJnY'><dir id='5HJnY'><q id='5HJnY'></q></dir></style></legend>

                  <small id='5HJnY'></small><noframes id='5HJnY'>

                    <tbody id='5HJnY'></tbody>

                  本文介绍了上传 facebook 事件图片引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用图片创建事件,但是当我将图片上传到 Facebook 时,它会向我抛出一个错误(#324) 缺少或无效的图片文件

                  I am trying to create event with picture, but when i upload picture to facebook it throws me an error (#324) Missing or invalid image file

                  这是上传图片的功能.

                  public function uploadFacebookEventPicture($fullPath, $eventId) {
                      $mainImage = '@' . $fullPath;   
                      $imgData = array(
                          'picture' => $mainImage
                      );
                      try {
                          $data = $this->facebook->api('/'.$eventId, 'post', $imgData);
                          return $data;
                      } catch (FacebookApiException $e) {
                          error_log('Failed to attach picture to event. Exception: ' . $e->getMessage());
                      }       
                      return null;
                  } 
                  

                  我在表单发布后使用的代码部分

                  the par of code i use after form post

                  if ($file[$name]['error'] == 0) {
                                                      $fileName = $file[$name]['name'];
                                                      $fileInfo = pathinfo($fileName);
                                                      $newFileName = md5($fileName . microtime()) . '.' . $fileInfo['extension'];
                                                      $fullPath = $this->config->applications->uploadPath . $newFileName;
                                                      $form->$name->addFilter('Rename', $fullPath);
                  
                                                      if ($form->$name->receive()) {
                                                          $resize = new SimpleImage();
                                                          $resize->load($fullPath);
                                                          $resize->resizeToWidth($this->config->applications->resize->width);
                                                          $resize->save($fullPath);
                                                          // Gathering data for saving files information
                                                          $fileInfo = array(
                                                              'name' => $newFileName,
                                                              'type' => FileTypes::IMAGE,
                                                              'description' => 'Application: Uploaded from Events form in back-end',
                                                          );
                  
                                                          $fileId = $dbFiles->save($fileInfo);
                  
                                                          $eventFileData = array(
                                                              'event_id' => $eventId,
                                                              'file_id' => $fileId,
                                                              'main_image' => ($name == 'mainImage') ? 1 : 0
                                                          );                                  
                                                          $dbEventFiles->save($eventFileData);
                                                          if ($name === 'mainImage') {
                                                              $success = **$this->uploadFacebookEventPicture($fullPath, $eventData['fb_event_id']**);
                                                          }
                                                      }
                                                  }
                  

                  facebook 对象是使用上传文件创建的

                  facebook object is created with upload file true

                   $facebook = new Facebook(array(
                                  'appId' => $config->facebook->appId,
                                  'secret' => $config->facebook->secret,
                                  'fileUpload' => true
                              ));
                  

                  推荐答案

                  根据 Facebook 的 bug tracker,这个 bug 已经修复:错误跟踪帖子

                  According to Facebook bug tracker, this bug has been fixed: Bug tracker post

                  Status changed to Fixed
                  

                  上面的代码适用于上传 facebook 活动图片.

                  Code above works fine for uploading facebook event picture.

                  这篇关于上传 facebook 事件图片引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Zend_Form:带有复选框的 HTML 表中的数据库记录 下一篇:数组合并具有相同索引的php

                  相关文章

                  <i id='XWRYL'><tr id='XWRYL'><dt id='XWRYL'><q id='XWRYL'><span id='XWRYL'><b id='XWRYL'><form id='XWRYL'><ins id='XWRYL'></ins><ul id='XWRYL'></ul><sub id='XWRYL'></sub></form><legend id='XWRYL'></legend><bdo id='XWRYL'><pre id='XWRYL'><center id='XWRYL'></center></pre></bdo></b><th id='XWRYL'></th></span></q></dt></tr></i><div id='XWRYL'><tfoot id='XWRYL'></tfoot><dl id='XWRYL'><fieldset id='XWRYL'></fieldset></dl></div>
                    <legend id='XWRYL'><style id='XWRYL'><dir id='XWRYL'><q id='XWRYL'></q></dir></style></legend>

                      <tfoot id='XWRYL'></tfoot>
                        <bdo id='XWRYL'></bdo><ul id='XWRYL'></ul>

                      <small id='XWRYL'></small><noframes id='XWRYL'>