News:

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

Main Menu

IMG Tags problem?

Started by Alisha, November 18, 2004, 02:14:42 PM

Previous topic - Next topic

Alisha

I wasnt able to see this problem anywhere else, so its somthing I did or doing wrong I guess.

I put:

[img]http://www.dancedancekc.com/images/DNS.jpg[/img]

in the message, and I get this in the message after preview:

[img width=437 height=400]http://www.dancedancekc.com/images/DNS.jpg[/img]

and this in the preview:

kc.com/images/DNS.jpg" alt="" width="437" height="400" border="0" />

after a broken image. I am running RC2 on viewing with foxfire 1.0

Any ideads?

NEVERMIND Problem is BACK! THis is driving me crazy... I thought it was in the theme I was using but now its in all the RC2 themes I installed.  The img tag worked before I upgraded to RC2, and those images are still there. But, any new images placed in the SIG or MSG comes out with this error, any ideas PLEASE???


Ok update, I think the problem is that it will not take GIF but will take JPG's ??? hmmmm

Alisha

 t.com/albums/v513/bstyledevi/devbanner1.jpg" alt="" width="400" height="50" border="0" />


ines.org/community/Themes/simple/images/tl1.jpg" alt="" width="332" height="85" border="0" />

Well these are the Errors I am now getting with JPGs...  I do not understand this, some JPGs work, some don't and some I havn't been able to get any gif to work.

Totaly lost as 2 why this is doing this?

Edit:

Sorry for the double post, I wasnt thinking... Totaly frustrated at the moment!

Anguz

Could you copy from your Subs.php file, the part in parsecode that deals with the image tag and paste it here?
Cristián Lávaque http://cristianlavaque.com

Alisha

Well I am going to give this a try, not sure what section you are wanting, so I will give you my BEST effort.

// Set the new image tag.
$replaces[$matches[0][$match]] = '<img src="' . preg_replace('~action(=|%3d)(?!dlattach)~i', 'action-', $imgtag) . '" width="' . $width . '" height="' . $height . '" alt="' . $matches[2][$match] . '" border="0" />';
}
elseif (strpos($matches[0][$match], '[url]') !== false || substr($matches[0][$match], 0, 4) == '&lt;')
$replaces[$matches[0][$match]] = '<img src="' . preg_replace('~action(=|%3d)(?!dlattach)~i', 'action-', $imgtag) . '" alt="' . $matches[2][$match] . '" border="0" />';
}

$message = strtr($message, $replaces);
}
}



This is the only thing that has image tag together in the file that I can see...

Anguz

The line with the UBBC img tag should be in the large array some lines before that code you posted.
Cristián Lávaque http://cristianlavaque.com

Alisha

this?

// Do <img ... /> - with security... action= -> action-.
preg_match_all('~&lt;img\s+src=(?:&quot;)?(?:\[url\])?((?:http://|ftp://|https://|ftps://).+?)(?:\[/url\])?(?:&quot;)?(?:\s+alt=(?:&quot;)?(.*?)(?:&quot;)?)?(?:\s?/)?&gt;~i', $message, $matches, PREG_PATTERN_ORDER);
if (!empty($matches[0]))
{
$replaces = array();
foreach ($matches[1] as $match => $imgtag)
{
// No alt?
if (!isset($matches[2][$match]))
$matches[2][$match] = '';

// Remove action= from the URL - no funny business, now.
if ($imgtag != preg_replace('~action(=|%3d)(?!dlattach)~i', 'action-', $imgtag))
$replaces[$matches[0][$match]] = '<img src="' . preg_replace('~action(=|%3d)(?!dlattach)~i', 'action-', $imgtag) . '" alt="' . $matches[2][$match] . '" border="0" />';

// Check if the image is larger than allowed.
if (!empty($modSettings['maxwidth']) && !empty($modSettings['maxheight']))
{
list ($width, $height) = url_image_size($imgtag);

if ($width > $modSettings['maxwidth'] || $height > $modSettings['maxheight'])
{
if ($width > $modSettings['maxwidth'] && !empty($modSettings['maxwidth']))
{
$height = floor($modSettings['maxwidth'] / $width * $height);
$width = $modSettings['maxwidth'];
if ($height > $modSettings['maxheight'] && !empty($modSettings['maxheight']))
{
$width = floor($modSettings['maxheight'] / $height * $width);
$height = $modSettings['maxheight'];
}
}
else
{
if ($height > $modSettings['maxheight'] && !empty($modSettings['maxheight']))
{
$width = floor($modSettings['maxheight'] / $height * $width);
$height = $modSettings['maxheight'];
}
}
}


Anguz

// An image.  Width and height can be are optional.
'~\[img(\s+width=([\d]+))?(\s+height=([\d]+))?\s*\](?:<br />)*(.+?)(?:<br />)*\[/img\]~ei' => isset($disabled['img']) ? '\'$5\'' : '\'<img src="$5" alt=""\' . (\'$2\' != \'\' ? \' width="$2"\' : \'\') . (\'$4\' != \'\' ? \' height="$4"\' : \'\') . \' border="0" />\'',
Cristián Lávaque http://cristianlavaque.com

Alisha

#7
// An image.  Width and height can be are optional.
'~\[img(\s+width=([\d]+))?(\s+height=([\d]+))?\s*\](?:<br />)*(.+?)(?:<br />)*\[/img\]~ei' => isset($disabled['img']) ? '\'$5\'' : '\'<img src="$5" alt=""\' . (\'$2\' != \'\' ? \' width="$2"\' : \'\') . (\'$4\' != \'\' ? \' height="$4"\' : \'\') . \' border="0" />\'',
// Size the font.  [size=large]HELLO![/size]
'~\[size=([\d]{1,2}p[xt]|(?:x-)?small(?:er)?|(?:x-)?large[r]?)\](.+?)\[/size\]~i' => isset($disabled['size']) ? '$2' : '<span style="font-size: $1;">$2</span>',
'~\[size=([\d])\](.+?)\[/size\]~i' => isset($disabled['size']) ? '$2' : '<font size="$1">$2</font>',
// Performat/justify text.  [center]Justifying is good.[/center]
'~\[pre\](.+?)\[/pre\]~i' => isset($disabled['pre']) ? '$1' : '<pre>$1</pre>',
'~\[left\](.+?)\[/left\]~i' => isset($disabled['left']) ? '$1' : '<div align="left">$1</div>',
'~\[right\](.+?)\[/right\]~i' => isset($disabled['right']) ? '$1' : '<div align="right">$1</div>',
'~\[center\](.+?)\[/center\]~i' => isset($disabled['center']) ? '$1' : '<div align="center">$1</div>',
// Teletyped text.  Monospace, in other words.
'~\[tt\](.+?)\[/tt\]~i' => isset($disabled['tt']) ? '$1' : '<tt>$1</tt>',
// Subscript and superscript.  6[sup]2[/sup] = 36.
'~\[sub\](.+?)\[/sub\]~i' => isset($disabled['sub']) ? '$1' : '<sub>$1</sub>',
'~\[sup\](.+?)\[/sup\]~i' => isset($disabled['sup']) ? '$1' : '<sup>$1</sup>',
// An email address. [email][email protected][/email]
'~\[email\](?:<br />)*(.+?)(?:<br />)*\[/email\]~i' => isset($disabled['email']) ? '$1' : '<a href="mailto:$1">$1</a>',
// Specify a specific font.  [font=Comic Sans]Blah![/font]
'~\[font=([\w,\-\s]+?)\](.+?)\[/font\]~i' => isset($disabled['font']) ? '$2' : '<span style="font-family: $1;">$2</span>',
// Colors.... [red]See?[/red]
'~\[color=(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[\w]{1,12})\](.*?)\[/color\]~i' => isset($disabled['color']) ? '$2' : '<span style="color: $1;">$2</span>',
'~\[(black|white|red|green|blue)\](.+?)\[/\1\]~i' => isset($disabled['color']) ? '$2' : '<span style="color: $1;">$2</span>',
'~\[(chr|k)issy\](.+?)\[/\1issy\]~i' => isset($disabled['color']) ? '$2' : '<span style="color: #CC0099;">$2 :-*</span>',
// Lists... [list][*]First, ...[o]Second![li]THIRD!!![/li][/list]
'~\[list\](?:<br />)?~i' => isset($disabled['list']) || isset($disabled['li']) ? '' : '<ul style="margin-top: 0; margin-bottom: 0;">',
'~\[/list\](?:<br />)?~i' => isset($disabled['list']) || isset($disabled['li']) ? '' : '</ul>',
'~(?:<br />|&nbsp;|\s)*\[li\](.+?)\[/li\](?:<br />|&nbsp;|\s)*~i' => isset($disabled['list']) || isset($disabled['li']) ? '<br />$1<br />' : '<li>$1</li>',
// Horizontal rule. [hr] => ------------------
'~\[hr(?:\s*/)?\]~i' => isset($disabled['hr']) ? '' : '<hr />',
// A break.  [br] or [br /]. (it makes no sense to disable this one :P.)
'~\[br(?:\s*/)?\]~i' => '<br />',
// Right-to-left and left-to-right strings.
'~\[(ltr|rtl)\](.+?)\[/\1\]~i' => isset($disabled['ltr']) || isset($disabled['rtl']) ? '$2' : '<div dir="$1">$2</div>',
// Acronyms and abbreviations... [acronym=Bulletin Board Code]BBC[/acronym]
'~\[abbr=((?:&quot;)?)(.+?)\\1\](.+?)\[/abbr\]~i' => isset($disabled['abbr']) ? '$3 ($2)' : '<abbr title="$2">$3</abbr>',
'~\[acronym=((?:&quot;)?)(.+?)\\1\](.+?)\[/acronym\]~i' => isset($disabled['acronym']) ? '$3 ($2)' : '<acronym title="$2">$3</acronym>',
// [me=Comment]does something[/me]
'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => isset($disabled['ftp']) ? '/me $3<br />' : '<div class="meaction">* $2 $3</div>',
// An email address they just typed in.  Don't match if there's already a mailto: or = before it.
'~(?<=[\?\s\xA0[\]()*\\\;>]|^)([\w\-\.]{1,80}@[\w\-]+\.[\w\-\.]+[\w\-])(?=[?,\s\xA0\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|&#039;|\.(?:\.|&nbsp;|\s|$|<br />))~i' => '<a href="mailto:$1">$1</a>',
'~(?<=<br />)([\w\-\.]{1,80}@[\w\-]+\.[\w\-\.]+[\w\-])(?=[?\.,\s\xA0\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|&#039;)~i' => '<a href="mailto:$1">$1</a>',
// This last one fixes spaces at the beginning of lines.
'~<br /> ~' => '<br />&nbsp;',
// Match a table... hopefully with everything in the right place.
'~\[table\](?:\s|\xA0|<br />|&nbsp;)*((?:\[tr\](?:\s|\xA0|<br />|&nbsp;)*\[td\]).*?(?:(?:\s|\xA0|<br />|&nbsp;)*\[/td\]\[/tr\])*)(?:\s|\xA0|<br />|&nbsp;)*\[/table\](?:\s|\xA0|<br />|&nbsp;)?~i' => '<table>$1</table>',
);

$codefromcache = array_keys($code_to_from);
$codetocache = array_values($code_to_from);



Here is a user posted sample Message where all links were entered the same way, and the results are very intresting.

http://dancedancekc.com/Forums/index.php?topic=192.msg507#msg507

Oldiesmann

We're going to need a test account to see that thread...
Michael Eshom
Christian Metal Fans

Alisha

Quote from: Oldiesmann on November 19, 2004, 02:01:12 PM
We're going to need a test account to see that thread...

Sorry, forgot  l:  BridgeTest p: testing

Oldiesmann

I think I figured it out. What do you have for the "split up words longer than..." value? It seems that's what's causing your problems.
Michael Eshom
Christian Metal Fans

Alisha

Quote from: Oldiesmann on November 19, 2004, 02:23:17 PM
I think I figured it out. What do you have for the "split up words longer than..." value? It seems that's what's causing your problems.


I knew it was something STUPID like that.  4 hours of google, and here. Poof the GREAT SMF Staff solves in 20 seconds.

I am sooo GRRR right now... installed Mods, uninstalled mods, redid code over and over.

I have no idea why I would have set that at 10 or what I was thinking! DOH!!!  But, this is why SMF is better than PHPBB! Genius Staff members that tolerate ignorant users.

THANK you sooooooo Much!!!!

Oldiesmann

No problem. It's amazing how small things like that can cause so many problems.
Michael Eshom
Christian Metal Fans

Alisha

Quote from: Oldiesmann on November 19, 2004, 02:33:29 PM
No problem. It's amazing how small things like that can cause so many problems.

You have no idea what this has done to my NON PhP brain.  This happen right after my first SMF upgrade from Beta5 - RC2, Installed all the mods again in the themes. My Default theme was in compatible with RC2 so I had to switch to a another until Final.  I almost scraped the whole thing and started over.  All because of a little option in the config.

Although, everyday I see unknowns point, over the last 24 hours, I have LEARNED a lot about SMF, PHP, and HTML. So, not a totally waste of my time, but wasted everyone Else's. Again sorry, to everyone that tried to help me! Many Thanks!


Anguz

It's good to know you solved it. :)
Cristián Lávaque http://cristianlavaque.com

Advertisement: