• [MOD] PMv2 Tutorial Republished here 5 0 5 1
Currently:  

Author Topic: [MOD] PMv2 Tutorial Republished here  (Read 771012 times)

0 Members and 2 Guests are viewing this topic.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] PMv2 Tutorial Republished here
« Reply #75 on: May 18, 2005, 12:08:43 AM »
First my thanks to v@no for this great MOD.
PM works since some time in the best way on my page ...  :D
But now I found that there is a problem with sending of php-code ...  :?
It is not possible to insert a curved clip ( { or } )  into a PM.
The curved clip ( and also the code between the clips ) disappears in the preview and then also in the sent PM.
This problem seems to arise not only on my page ...  8O
Tests your PM ... (v@no, martrix, ... )

Is there a solution for this problem ?

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #76 on: June 07, 2005, 03:52:21 PM »
Yes - this also occurs on my page...  :|

But there's one thing even more confusing:

if I use the tag [thumb=xxxx] it sometimes shows the thumbnail well, sometimes distorted absolutely and sometimes (if using more than one thumb)
it shows this - or simila - error

Quote
DB Error: Bad SQL Query: SELECT image_name, image_id, image_media_file, image_thumb_file, cat_id FROM 4images_images WHERE image_id = 2172]
You have an error in your SQL syntax near '] ' at line 3

 :?
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] PMv2 Tutorial Republished here
« Reply #77 on: June 07, 2005, 05:57:41 PM »
hi martrix,

the tag [thumb=xxxx] (in my BB-Tag-Editor you can use also a thumb-button ...  :wink:) works correct for me, also with more than one thumb.
test your thumb-tags with a space between the tags ...  :roll: ... that should help.

again to the curved clips (is that the correct word for -> { ... ? ... or better -> brackets)
I found this in funktions.php in function bb_code and I think here is the cause ... ?
Code: [Select]
if ($brackets) {
     $entities_match = array('{', '}');
     $entities_replace = array('{', '}');
    $text = str_replace($entities_match, $entities_replace, $text);
  }

I am right ...  :?:
mawenzi


Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #78 on: June 07, 2005, 07:14:52 PM »
sure - a space between the tags is always needed... that's clear, but in some cases you can't even add one thumb-tag and you will get an error...
or in one Moment a simplee

Code: [Select]
[thumb=xxx]
works fine, but if I write more behind that like e.g.:

Code: [Select]
[thumb=xxx]
blablabla
[img]adress[/img]
blablabla

it gives me an error :(
it doesn't show any thumbnail at all and the img-tag gets messed up...

if I have a thumbnail of for example 128x96 px it will be shown as a square of 96x96 px - which looks quite strange in some cases...
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] PMv2 Tutorial Republished here
« Reply #79 on: June 07, 2005, 07:36:48 PM »
Quote
it gives me an error  :(

your "code" works correct in my PM ... it shows the thumbnail and the image ...  :roll:
there must be an error in your BB_code ...  :?

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #80 on: June 07, 2005, 09:20:14 PM »
the error
Quote
DB Error: Bad SQL Query: SELECT image_name, image_id, image_media_file, image_thumb_file, cat_id FROM 4images_images WHERE image_id = 2172]
You have an error in your SQL syntax near '] ' at line 3

DB Error: Bad SQL Query: SELECT image_name, image_id, image_media_file, image_thumb_file, cat_id FROM 4images_images WHERE image_id = 2172]
You have an error in your SQL syntax near '] ' at line 3
is not from my site and occured also only a thumbnail was shown...

if there's something wrong with "my" bbcode, than it is also wrong in all others bbcode - I just tried to replace "my" bbcode with the original code from this page and it still makes the same mess.

Would you please mind and post your function bb_code()?
Maybe the solution will be there...

MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] PMv2 Tutorial Republished here
« Reply #81 on: June 08, 2005, 12:06:37 AM »
I will send you a pm ...  :wink:

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] PMv2 Tutorial Republished here
« Reply #82 on: June 08, 2005, 01:00:03 AM »
ok, guys, I've updated step 6.2 which fixes the {} brackets and [thumb=] tag.

P.S. I dont recall when I ever mentioned the [thumb=] feature...how did u find it? :|
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #83 on: June 08, 2005, 09:50:15 AM »
you did never mention it, but it is there :wink: right?

that's what made me curious about that, when changing smilies in the code (try :jedi: or :beer: on my page  :wink: ):
Quote
$text = preg_replace("/\[thumb=([0-9]+)(,([0-9]+)?)?(,([a-zA-Z]+))?\]/esi","thumb('\\1','\\3','\\5')",$text);
And second: I saw mawenzi using that feature a few times and thought first it is some of his own innovations  :D


thanks!
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] PMv2 Tutorial Republished here
« Reply #84 on: June 08, 2005, 01:05:47 PM »
hi martrix, hi v@no,

with the [FIX] brackets/thumb-tag is Private Messaging nearly perfect ...  :wink:
one thing still remains ...
if I want to send the following code with PM :
Code: [Select]
$entities_replace = array('{', '}');it shows now the following code :
Code: [Select]
$entities_replace = array('{', '}');is there still another FIX from the FIX ...  :wink: ... ?

Quote from: V@no
P.S. I dont recall when I ever mentioned the [thumb=] feature...how did u find it?  :|

V@no ... remember ... some time ago there was on gallery.vano.org a reference-/toolbox with some useful things and also the thumb-tag ...  :mrgreen: ... my only "innovation" is now a Thumb-Button in my BB-Tag-Editor ...  :wink:

thanks guys ... !
mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

drhtm

  • Guest
Re: [MOD] PMv2 Tutorial Republished here
« Reply #85 on: June 10, 2005, 07:58:53 PM »
Hi,

I'm trying to create 'short urls' for this mod and I could use some help.

For the sessions.php, i got this
Code: [Select]
      elseif (strstr($url, 'pm.php')) {
        if (strstr($url, 'page=')) {
          preg_match('#page=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('pm.php', 'pm.'.$matches[1].'.html', $url);
            $query = str_replace('action='.$matches[1].'&', '', $query);
            $query = str_replace('&user_id='.$matches[1], '', $query);
            $query = str_replace('mode='.$matches[1], '', $query);
            $query = str_replace('id='.$matches[1], '', $query);
            if (!empty($query)) {
              $url .= '?' . $query;
            }
          }
        }

and for my htaccess i'm using this

Code: [Select]
RewriteRule ^pm\.html$ pm.php?%{QUERY_STRING}
RewriteRule ^pm-(.*)\.html$ pm.php?action=$1&%{QUERY_STRING}
RewriteRule ^pm-(.*)\.([0-9]+)\.html$ pm.php?action=$1&user_id=$2&%{QUERY_STRING}
RewriteRule ^pm-(.*)\.(.*)\.([0-9]+)\.html$ pm.php?action=$1&mode=$2&id=$3&%{QUERY_STRING}

But it's not working exactly.  can someone tell me if i'm doing it right?  I posted some help at the 'mod for shorturls' but no one is replying there.

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #86 on: June 10, 2005, 10:14:22 PM »
strange, but your update of step 6.2 caused just a white page showed after trying to preview/send the pm...

I found the reason here:

Code: [Select]
$image_info = @get_imagesize($file_src, $info);should be
Code: [Select]
$image_info = @getimagesize($file_src, $info);

The change did also not fix my problem with the distorted thumbnails (the thumbs were always square)

well - so I changed the function Thumb from

Code: [Select]
function thumb($id, $dim = 50, $align = "bottom") {
  global $site_db, $user_info, $site_sess;
  if (empty($dim)) $dim = 50;
  if (empty($align)) $align = "bottom";
  $text = "";
  $sql = "SELECT image_name, image_id, image_media_file, image_thumb_file, cat_id
          FROM ".IMAGES_TABLE."
          WHERE image_id = ".$id;
  if ($row = $site_db->query_firstrow($sql)) {
    if (!get_file_path($row['image_thumb_file'], "thumb", $row['cat_id'], 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
    }else{
      $file_src = get_file_path($row['image_thumb_file'], "thumb", $row['cat_id'], 0, 1);
    }
    $image_info = @getimagesize($file_src, $info);
    $width = $image_info[0];
    $height = $image_info[1];
    $wh = get_resize($image_info[0], $image_info[1], $dim, $dim);
    $text = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\"><img width = \"".$wh[0]."\" height=\"".$wh[1]."\" src=\"".$file_src."\" alt=\"".str_replace("\"", "&quot;", $row['image_name'])."\" align=\"".$align."\" border=\"1\" /></a>";
  }
  return $text;
}

into

Code: [Select]
function thumb($id, $dim = 50, $align = "bottom") {
  global $site_db, $user_info, $site_sess;
  if (empty($align)) $align = "bottom";
  $text = "";
  $sql = "SELECT image_name, image_id, image_media_file, image_thumb_file, cat_id
          FROM ".IMAGES_TABLE."
          WHERE image_id = ".$id;
  if ($row = $site_db->query_firstrow($sql)) {
    if (!get_file_path($row['image_thumb_file'], "thumb", $row['cat_id'], 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
    }else{
      $file_src = get_file_path($row['image_thumb_file'], "thumb", $row['cat_id'], 0, 1);
    }
    $image_info = @getimagesize($file_src);
    $width = $image_info[0];
    $height = $image_info[1];
$dimension = 50;
    $ratio = $width / $height;
      if ($ratio > 1) {
        $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
      }else {
        $new_width = floor(($dimension/$height) * $width);
        $new_height = $dimension;
      }
    $text = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\"><img width = \"".$new_width."\" height=\"".$new_height."\" src=\"".$file_src."\" alt=\"".str_replace("\"", "&quot;", $row['image_name'])."\" align=\"".$align."\" border=\"1\" /></a>";
  }
  return $text;
}

and deleted the whole function get_resize()

I don't know if I messed something up with that, but it works fine now...
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] PMv2 Tutorial Republished here
« Reply #87 on: June 11, 2005, 12:12:46 AM »
oh, crap, by any chance, do u have unchanged code from step 6.2 ?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] PMv2 Tutorial Republished here
« Reply #88 on: June 11, 2005, 12:37:38 AM »
Yes, I'll find it and send it via PM
MAяTRIX


izzy

  • Guest
Re: [MOD] PMv2 Tutorial Republished here
« Reply #89 on: June 13, 2005, 08:42:52 AM »
Just checked out the FAQ to fix a few bugs in 1.7.1 that showed up in this mod - conditional tags mainly.
Very nice mod - works just as intended now.
Thank you!  :D
Izzy