Custom set of photo sizes, cURL and PHP

You must Login before you can answer or comment on any questions.

What is the correct way to get customized photo sizes with php?

$acs_app_key = '';
 
  $data = array(
    'title' => $post_title,
    'content' => $post_content,
    'photo' => '@header.jpg',
    //'photo_sizes[android]' => '480x225',
    //'photo_sizes[retina]' => '640x300',
    //'photo_sizes[iphone]' => '320x150', 
    'photo_sizes' => array( 'android' => '480x225',
                            'retina' => '640x300',
                            'iphone' => '320x150')
    );
 
  /*
  $data = 'title='.$post_title.'&content='.$post_content;
  $data .= '&photo=@header.jpg';
  $data .= '&photo_sizes[android]=480x225';
  $data .= '&photo_sizes[retina]=640x300';
  $data .= '&photo_sizes[iphone]=320x150';
  */
 
  $url = 'https://api.cloud.appcelerator.com/v1/posts/create.json?key='.$acs_app_key;
  $ch = curl_init($url);
 
  curl_setopt($ch, CURLOPT_COOKIEJAR, 'appccookie.txt');
  curl_setopt($ch, CURLOPT_COOKIEFILE, 'appccookie.txt');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 
  curl_setopt($ch, CURLOPT_POST, TRUE);
  //curl_setopt($ch, CURLOPT_PUT, TRUE);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 
  $output = curl_exec($ch);
 
  var_dump($output);

— asked 10 months ago by Francisco G
1 Comment
  • Why is that on mine, $data .= '&photo=@header.jpg'; doesn't work. It keeps saying the following error:

    ( [meta] => stdClass Object ( [status] => fail [code] => 400 [message] => Failed to upload photo: Failed to indentify photo file [method_name] => updatePlace ) )

    — commented 4 months ago by Snapp Coupon

1 Answer

Your Answer

Think you can help? Login to answer this question!