function dynamic_banner_image_handler in Dynamic Banner 7.2
Same name and namespace in other branches
- 7 includes/callbacks.inc \dynamic_banner_image_handler()
- 8.x dynamic_banner.module \dynamic_banner_image_handler()
This function will load imgurl if there is no url for img Then it will load the fids into path format
Input 1: The imgurl(s) that we are loading [maybe csv] Input 2: The imgfid(s) that we are loading [maybe csv]
2 calls to dynamic_banner_image_handler()
- dynamic_banner_admin_page in ./
dynamic_banner.module - Return a listing of all defined URL aliases. When filter key passed, perform a standard search on the given key, And return the list of matching URL aliases.
- dynamic_banner_block_view in ./
dynamic_banner.module - Implements hook_block_view().
File
- ./
dynamic_banner.module, line 977 - Distributed under GNU GPL version 3
Code
function dynamic_banner_image_handler($imgurl, $imgfid) {
// We have found the imgurl already in the right format return it
if ($imgurl && $imgurl != '') {
return $imgurl;
}
else {
if (strrpos($imgfid, ',')) {
// Split the plain string into an array
$all_fids = explode(',', $imgfid);
// Load all files at once
$all_files = file_load_multiple($all_fids);
$retval = '';
// Default the return string
// Go into all the loaded files
foreach ($all_files as $file) {
// If this is the first time through do not add a comma to the string
if ($retval != '') {
$retval .= ',';
}
// Have to translate the public string in the uri back into something browsers understand
$retval .= file_create_url($file->uri);
}
return $retval;
}
else {
$file = file_load($imgfid);
// Have to translate the public string in the uri back into something browsers understand
$file_path = file_create_url($file->uri);
return $file_path;
}
}
}