Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By najubudeen on
hi, i want to display an image into image tag from private folder destination. how do i do that?
i changed these things in my media/file-system.
1 . Public file system path : sites/default/files
2 . Private file system path : sites/default/files/private/my_privatefolder
3 . Default download method : Public local files served by the webserver.
below is my codes.
function my_module_permission(){
return array(
'my permission' => array(
'title' => 'permission for image',
'description' => 'permission image',
'restrict access' => TRUE,
),
);
}
function my_module_menu(){
$items['print_image'] = array(
'title' => 'some title',
'page callback' => 'my_module_page',
'access arguments' => array('my permission'),
'type' => MENU_CALLBACK,
);
return $items;
}
function my_module_page(){
$output = '';
$private_img = 'sites/default/files/private/my_privatefolder/images/20140723072203.jpg';
$private_image = theme('image', array('path' => $private_img, ' width'=>'100','height' => '100','alt' => 'image', 'title' => 'My image', ));
$output = $private_image;
return $output;
}