Hallo o2x,
Ik heb een paar maanden geleden een UBB parser gevonden waar ik inmiddels het nodige aan veranderd heb, maar nu zit ik met 2 problemen.
1. Als een afbeelding breder is dan 900 pixels moet ie verkleind worden en moet het een link worden. Daarvoor heb ik deze code:
Als ik dan
doe werkt het wel maar als ik
doe werkt het niet. maar ik heb geen idee wat het probleem is
2. Als ik de UBB code
heb dan ziet het er heel verneukt uit:
Afbeelding niet beschikbaarDe bron kon niet worden geladen (images.luukvdo.nl).Bron openen ↗de code:
Help aub
Ik heb een paar maanden geleden een UBB parser gevonden waar ik inmiddels het nodige aan veranderd heb, maar nu zit ik met 2 problemen.
1. Als een afbeelding breder is dan 900 pixels moet ie verkleind worden en moet het een link worden. Daarvoor heb ik deze code:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] image_resize[COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$font[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$image_size[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/getimagesize"]getimagesize[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$image_width[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$image_size[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$image_width[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]900[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$value[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$image_width[/COLOR] / [COLOR= #0000BB]900[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$image_height[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$image_size[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$image_height[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/round"]round[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$image_height[/COLOR] / [COLOR= #0000BB]$value[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$image[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<center><a href="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" target="_blank"><font face="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$font[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" color="#000000" size="2">De afbeelding is verkleind. Klik om te vergroten</font><br><img src="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" width="900" height="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$image_height[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" border="1"></a></center>[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$image[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<img src="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" border="1">[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$image[/COLOR][COLOR= #007700];
}[/COLOR]
?> Als ik dan
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] image_resize[COLOR= #007700]([/COLOR][COLOR= #DD0000]http://www.apachefriends.org/images/1238.jpg[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]Comic Sans MS[/COLOR][COLOR= #007700]);[/COLOR]
?> doe werkt het wel maar als ik
[COLOR= #0000BB]<?php
$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#[img](.*?)[/img]#"[/COLOR][COLOR= #007700],[/COLOR] image_resize[COLOR= #007700]([/COLOR][COLOR= #DD0000]"\1"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"Comic Sans MS"[/COLOR][COLOR= #007700]),[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
?> doe werkt het niet. maar ik heb geen idee wat het probleem is
2. Als ik de UBB code
[QUOTE]
[QUOTE]
aap
[/quote]
Dat is niet aardig
[/quote]
haha heb dan ziet het er heel verneukt uit:
Afbeelding niet beschikbaarDe bron kon niet worden geladen (images.luukvdo.nl).Bron openen ↗$bericht = preg_replace("#[QUOTE](.+?)[/quote]#", "<blockquote><b>\1 schreef:</b><table cellpadding="3" cellspacing="0" class="bbcode"><tr><td class="bb_quote">\2</td></tr></table></blockquote>", $bericht); Help aub




Wist niks anders 