Skocz do zawartości
Hosting webh.pl - 20%

Auto Image Resize + [BBCODE]

Rekomendowane odpowiedzi

Opublikowano

Witam zainstalowalem moda Auto Image Resize i ma taka wade ze nawet male fotki zmiejsza do jeszcze mniejszych.

  • Moze mozna jakos to naprawic ??
  • Ja narazie go omninelem dodajac dodatkowy zalacznik w BBCODE tylko chcialbym zeby byl on widoczny obok standardowych zalacznikow BBCODE takich jak ... itp. A najlepiej zaraz kolo ... jak i gdzie to zrobic ??

Kod Auto Image Resize:

/*

+-------------------------------------------------------------------

| Invision Power Board 2.1 Modification

| Provided as is, use at your own risk

|

| Automatic Resize in topics

| By: Lateralus

| Orignal Code (for IPB 2.0.x) By: BigBallerAlwayz

| Orignal Code (for IPB 1.3) By: Quang Trung

+--------------------------------------------------------------------

*/

- What does this mod do?

This modification resizes images that use the bbcode

to the size defined by "Attachment thumbnail size" inside of the

Admin Cpanel. The image will be clickable and launch in new window

if user(s) wishes to view the full image.

This allows forums to maintain orignal look and allow topics to load

much faster then before. This is a 2.1 mod but is also available for

2.0 (by BigBallerAlwayz) and 1.3 (by Quang Trung).

It is a small three files modification.

- Files to edit

sources/classes/bbcode/class_bbcode.php

sources/classes/bbcode/class_bbcode_core.php

sources/classes/bbcode/class_bbcode_legacy.php

//-------------------------------------------------------------------

//-------------------------------------------------------------------

/*in file: sources/classes/bbcode/class_bbcode.php*/

FIND [in function pre_edit_parse()]:

$txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );

ADD below:

$txt = preg_replace( "#<!--ImageUrlBegin-->(.+?)<!--ImageUrlEBegin-->#" , '' , $txt );

$txt = preg_replace( "#<!--ImageUrlEnd-->(.+?)<!--ImageUrlEEnd-->#" , '' , $txt );

$txt = preg_replace( "#<img .+? src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );

/*in file: sources/classes/bbcode/class_bbcode_legacy.php*/

Find [in function pre_edit_parse()]:

$txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );

ADD below:

$txt = preg_replace( "#<!--ImageUrlBegin-->(.+?)<!--ImageUrlEBegin-->#" , '' , $txt );

$txt = preg_replace( "#<!--ImageUrlEnd-->(.+?)<!--ImageUrlEEnd-->#" , '' , $txt );

$txt = preg_replace( "#<img .+? src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );

/*in file: sources/classes/bbcode/class_bbcode_core.php*/

FIND [in function regex_check_image()]:

return "<img src=\"$url\" border=\"0\" alt=\"IPB Image\" />";

REPLACE with:

// START Image Auto Resize Mod

$qt_maxwidth = $this->ipsclass->vars['siu_width'];

$qt_img_info = getimagesize("$url");

$qt_out_width = 0;

$qt_alt = "User posted image";

if ($qt_img_info[0] > $qt_maxwidth and $in['SIGNATURE'] != 1){

$qt_out_width = $qt_maxwidth;

return "<!--ImageUrlBegin--><a href=\"$url\" target=\"_new\"><!--ImageUrlEBegin--><img width=\"$qt_out_width\" class=\"attach\" src=\"$url\" border='0' alt=\"$qt_alt\" /><!--ImageUrlEnd--></a><!--ImageUrlEEnd--><br />";

}

else return "<img src=\"$url\" border=\"0\" alt=\"IPB Image\" />";

// END Image Auto Resize Mod

Save & upload all the edited files

Opublikowano
Ja narazie go omninelem dodajac dodatkowy zalacznik w BBCODE tylko chcialbym zeby byl on widoczny obok standardowych zalacznikow BBCODE takich jak ... itp. A najlepiej zaraz kolo ... jak i gdzie to zrobic ??

Dodaj go w sources/classes/class_post.php <-- tam masz buttony code, img itp - na ich wzór dodaj sobie button z tego moda.

//dodatkowo możesz go dodać do ekranu edycji posta (chyba class_post_edit.php ..czy jakoś tak).

Pzdr

Opublikowano
  • Autor

Patrzylem te pliki ale nie moge znalesc tych linii ktore by za to odpowiadaly.

Znalazlem gdzie mozna dodac ikonki obok tamtych standardowych :

cache/skin_cache/cacheid_2/skin_editors.php

Linijka 222:

<!--/SEP-->

<td><div><img class="rteimage" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/hyperlink.gif" width="25" height="24" alt="{$this->ipsclass->lang['js_tt_link']}" title="{$this->ipsclass->lang['js_tt_link']}" onclick="tag_url()"></div></td>

<td><div><img class="rteimage" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/email.gif" width="25" height="24" alt="{$this->ipsclass->lang['js_tt_email']}" title="{$this->ipsclass->lang['js_tt_email']}" onclick="tag_email()"></div></td>

<td><div><img class="rteimage" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/image.gif" width="25" height="24" alt="{$this->ipsclass->lang['js_tt_image']}" title="{$this->ipsclass->lang['js_tt_image']}" onclick="tag_image()"></div></td>

<!--SEP-->

<td><img class="rteVertSep" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/blackdot.gif" width="1" height="20" border="0" alt=""></td>

<!--/SEP-->

<td><div id='do_quote'><img class="rteimage" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/quote.gif" width="21" height="21" alt="{$this->ipsclass->lang['js_tt_quote']}" title="{$this->ipsclass->lang['js_tt_quote']}" onclick="simpletag('quote')"></div></td>

<td><div id='do_code'><img class="rteimage" src="{$this->ipsclass->vars['img_url']}/folder_rte_images/code.gif" width="21" height="21 alt="{$this->ipsclass->lang['js_tt_code']}" title="{$this->ipsclass->lang['js_tt_code']}" onclick="simpletag('code')"></div></td>

</tr>

Tylko nie wiem jak zrobic zeby w tje dtugiej funkcji [.img] [/.img] byla ta co ja chce tzn. nazwalem [sig] [/sig]

Tak samo chcialbym zrobic z [.code] [/.code] i zamiast tego zeby bylo [.codebox] [/.codebox]

Opublikowano

musisz poszukać tych danych klasy owej nowej funkcji w instalatorze moda ...//ew w .xml z ustawieniami jeśli takowy posiada.

Opublikowano
  • Autor

A moglbys dac przykladowy kod jaki trzeba zrobic bo dopiero sie ucze PHP.

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.