Get Image path in drupal

382 views Asked by At

may be this question has been asked earlier but i have not found an appropriate answer for this. I have image uri path and i want to create a web services in drupal. From android when i call this webservices i will send the uri then i want to get the image url that will return me my custom image style url. But when i am passing the url with file extension giving me Could not find the Controller This is my function that will return the url of the image:

 'image_url' => array('operations' => array('retrieve' => array(
      'help' => t('The resource to retrive the image of the given url/uri.'),
      'callback' => '_fieldinsync_image_url_retrieve',
      'args' => array(
          array(
                'name' => 'url',
                'optional' => FALSE,
                'source' => array('path' => 'url'),
                'type' => 'string',
                'description' => 'The url/uri of the image.',
         )),
      'access callback' => 'services_access_menu',
    ),),),

Function:

function _fieldinsync_image_url_retrieve($imgUrl){

  $value;
  $value[]=array(
  'vname'=> 'session_id',
  'sname' => 'session_name');
   $value['uri'] = image_style_url('mobile_product_image', $imgUrl);

return $value;
 }

Uri is :public://Tab - A2107.jpg

1

There are 1 answers

0
rupesh On BEST ANSWER

got my Answer

needs to add these lines in settings.php

$conf['image_allow_insecure_derivatives'] = TRUE;