News:

Wondering if this will always be free?  See why free is better.

Main Menu

I need PNG icons support in BBC

Started by ameo, May 09, 2015, 03:07:53 PM

Previous topic - Next topic

ameo

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?
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

NanoSector

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,
);
}
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

ameo

so, i deleted glow.gif and uploaded glow.png

but glow.png doesn't show, even though i made your changes in the code. :(
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

ameo

this is PASTIE of how my code looks like now


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.
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

ameo

Anyone care to help? I still need this.
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

ameo

antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

margarett

#7
The code above relates to the POST icons, the ones that show in each message. Eg:



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']) ? ',' : '';
}

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Illori

i have PM'ed margarett, his code does not work. i somewhat fixed it but i still get an error.

margarett

Should work now, thanks for testing ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

ameo

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
antechinus:
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum

|±(ಠ_ಠ
)±|

Advertisement: