How do I make changes so forum would support PNG images in BBC?
I'm pretty sure I have to add png extension here:
$icons = array();
foreach ($icon_data as $icon)
{
$icons[$icon['filename']] = array(
'value' => $icon['filename'],
'name' => $icon['title'],
'url' => $settings[file_exists($settings['theme_dir'] . '/images/post/' . $icon['filename'] . '.gif') ? 'images_url' : 'default_images_url'] . '/post/' . $icon['filename'] . '.gif',
'is_last' => false,
);
}
but how exactly, so I don't encounter syntax errors?
Try
$icons = array();
foreach ($icon_data as $icon)
{
if (file_exists($settings['theme_dir'] . '/images/post/' . $icon['filename'] . '.gif'))
$url = $settings['images_url'] . '/post/' . $icon['filename'] . '.gif';
elseif (file_exists($settings['theme_dir'] . '/images/post/' . $icon['filename'] . '.png'))
$url = $settings['images_url'] . '/post/' . $icon['filename'] . '.png';
else
$url = $settings['default_images_url'] . '/post/' . $icon['filename'] . '.gif';
$icons[$icon['filename']] = array(
'value' => $icon['filename'],
'name' => $icon['title'],
'url' => $url,
'is_last' => false,
);
}
so, i deleted glow.gif and uploaded glow.png
but glow.png doesn't show, even though i made your changes in the code. :(
Did you upload it to all themes?
this is PASTIE of how my code looks like now (http://pastie.org/10181497)
also, i've put glow.png in 1. current theme i'm using 2. in default theme.
doesn't display image, that is, browser displays image as broken.
Anyone care to help? I still need this.
*bump*!
The code above relates to the POST icons, the ones that show in each message. Eg:
(http://media.simplemachinesweb.com/smf/default/images/post/xx.gif)
(http://media.simplemachinesweb.com/smf/default/images/post/clip.gif)
The BBC icons are in images/bbc and the code that handles them is
// Here loop through the array, printing the images/rows/separators!
foreach ($context['bbc_tags'] as $i => $buttonRow)
{
echo '
[';
foreach ($buttonRow as $tag)
{
// Is there a "before" part for this bbc button? If not, it can't be a button!!
if (isset($tag['before']))
echo '
{
sType: \'button\',
bEnabled: ', empty($context['disabled_tags'][$tag['code']]) ? 'true' : 'false', ',
sImage: ', JavaScriptEscape($settings['images_url'] . '/bbc/' . $tag['image'] . '.gif'), ',
sCode: ', JavaScriptEscape($tag['code']), ',
sBefore: ', JavaScriptEscape($tag['before']), ',
sAfter: ', isset($tag['after']) ? JavaScriptEscape($tag['after']) : 'null', ',
sDescription: ', JavaScriptEscape($tag['description']), '
}', empty($tag['isLast']) ? ',' : '';
// Must be a divider then.
else
echo '
{
sType: \'divider\'
}', empty($tag['isLast']) ? ',' : '';
}
This works:
// Here loop through the array, printing the images/rows/separators!
foreach ($context['bbc_tags'] as $i => $buttonRow)
{
echo '
[';
foreach ($buttonRow as $tag)
{
// Is there a "before" part for this bbc button? If not, it can't be a button!!
if (isset($tag['before']))
{
if (file_exists($settings['actual_theme_dir'] . '/images/bbc/' . $tag['image'] . '.gif'))
$url = $settings['actual_images_url'] . '/bbc/' . $tag['image'] . '.gif';
elseif (file_exists($settings['actual_theme_dir'] . '/images/bbc/' . $tag['image'] . '.png'))
$url = $settings['actual_images_url'] . '/bbc/' . $tag['image'] . '.png';
elseif (file_exists($settings['default_theme_dir'] . '/images/bbc/' . $tag['image'] . '.png'))
$url = $settings['default_images_url'] . '/bbc/' . $tag['image'] . '.png';
else
$url = $settings['default_images_url'] . '/bbc/' . $tag['image'] . '.gif';
echo '
{
sType: \'button\',
bEnabled: ', empty($context['disabled_tags'][$tag['code']]) ? 'true' : 'false', ',
sImage: ', JavaScriptEscape($url), ',
sCode: ', JavaScriptEscape($tag['code']), ',
sBefore: ', JavaScriptEscape($tag['before']), ',
sAfter: ', isset($tag['after']) ? JavaScriptEscape($tag['after']) : 'null', ',
sDescription: ', JavaScriptEscape($tag['description']), '
}', empty($tag['isLast']) ? ',' : '';
}
// Must be a divider then.
else
echo '
{
sType: \'divider\'
}', empty($tag['isLast']) ? ',' : '';
}
i have PM'ed margarett, his code does not work. i somewhat fixed it but i still get an error.
Should work now, thanks for testing ;)
Works like a charm. :)
Thank you very much, both of you.
I'm thankful and glad you helped me.
Cheers!
I'd just say, for any future reference that this code above is in file:
Themes/Default/GenericControls.template.php
I've barely found it, haha :D