本文整理匯總了PHP中td_demo_media::get_image_url_by_td_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP td_demo_media::get_image_url_by_td_id方法的具體用法?PHP td_demo_media::get_image_url_by_td_id怎麽用?PHP td_demo_media::get_image_url_by_td_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類td_demo_media
的用法示例。
在下文中一共展示了td_demo_media::get_image_url_by_td_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parse_content_file
private static function parse_content_file($file_path)
{
$file_content = file_get_contents($file_path);
preg_match_all("/xxx_(.*)_xxx/U", $file_content, $matches, PREG_PATTERN_ORDER);
/*
$matches =
[0] => Array
(
[0] => xxx_td_pic_5:300x200_xxx
[1] => xxx_td_pic_5_xxx
)
[1] => Array
(
[0] => td_pic_5:300x200
[1] => td_pic_5
)
*/
if (!empty($matches) and is_array($matches)) {
foreach ($matches[1] as $index => $match) {
$size = '';
//default image size
//try to read the size form the match - NOT USED 29.05.2015
if (strpos($match, ':') !== false) {
$match_parts = explode(':', $match);
$match = $match_parts[0];
$size = explode('x', $match_parts[1]);
//print_r($size);
}
$file_content = str_replace($matches[0][$index], td_demo_media::get_image_url_by_td_id($match, $size), $file_content);
}
}
unset($matches);
preg_match_all("/iii_(.*)_iii/U", $file_content, $matches, PREG_PATTERN_ORDER);
if (!empty($matches) and is_array($matches)) {
foreach ($matches[1] as $index => $match) {
$file_content = str_replace($matches[0][$index], td_demo_media::get_by_td_id($match), $file_content);
}
}
return $file_content;
}