Log in | Register | Lost password

Bottom
Photoshare Pics in PNphpBB2 1.2g and PN .750
  • Posted: 06.12.2004, 01:28
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I used to be able to post pictures from my photoshare gallery into PNphpBB2 using the BBcode image tags. It doesn't work anymore, not even using HTML tags. However, any images that were posted before I upgraded to PN .750 and PNphpBB2 1.2g still work.

    Totally stumped here...

    [Edited on 6/12/2004 by gtoddv]

    [Edited on 6/12/2004 by gtoddv]
  • Posted: 06.12.2004, 14:32
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    OK I found something on the PNphpBB2 support forum:

    http://pnphpbb.…ght=photoshare

    It appears that the current implementation of BBcode that is used in PNphpbb2 1.2g does NOT allow dymanic links (the kind photoshare uses) to an image be imbedded in a post. This appears to be a security related limitation. If you are using Photoshare and an earlier version of PNphpBB2 DON'T upgrade unless you ARE NOT trying to post photoshare pictures in a forum.

    To put this more directly, if photoshare linked directly to the image (e.g. http://www.yoursite.com/index.php?module=photoshare&func=viewimage&iid=1201.jpg) as opposed to how it does it now(e.g. http://www.nscale.net/index.php?module=photoshare&func=viewimage&iid=1201&viewkey=) the problem would be fixed.

    The odd thing about this issue (as stated in my previous post) is that pictures that were posted before the PNphpBB2 upgrade still manage to appear in posts. It is only when you try to post a picture AFTER the upgrade to 1.2g that it doesn't work. When a post was saved to the database, it must have included code that provided a direct, non-dynamic , link.

    Unless a fix can be found I may have to move to a different gallery package. This of course is a problem because one of the main reasons I use photoshare is the integration with Pagesetter. I am going to go sulk now..... :(

    [Edited on 6/12/2004 by gtoddv]
  • Posted: 06.12.2004, 14:52
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Checked your references ...

    Apparently BB2 checks for ".jpg" etc. on the img urls. I don't know how solid that check is, but what about:

    1) http://www.yoursite.com/index.php?module=photoshare&fun c=viewimage&iid=1201&scrap=image.jpg - slightly different ending than yours.

    It may although be that BB2 also checks for a "?" or "&" in the URL - which is the real indication of this being a dynamic URL.

    2) You can also use short urls and add a rule for ".../imageX.jpg" to map into "/index.php?func=photoshare&...&iid=X"

    I can't see the reason for BB2 adding this requirement - if it is for security then it's crap, since you can always disguise a dynamic url as normal url using short urls rewriting.
  • Posted: 06.12.2004, 15:01
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I can't see a reason for it either. I am looking at the bbcode php file right now to see if it is worth hacking. It appears that the difference between previous versions and the current one is that previous version converted the bbcode image tag to an html imaged tag without conditions. Remove the condition and you probably have success.

    I have not had very good success at altering rewrite rules so I am hesitant to go that direction. Everytime I have edited or added one I have brought my site down! :P

    I will post if I get anywhere with this.

    Thanks!
  • Posted: 06.12.2004, 15:06
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    By the way, your first idea would be good if it made it into a future version of photoshare. I say this for two reasons:

    1. It would mean that no hacking would have to be done to PNphpBB2 which would allow an easier upgrade path.

    2. It would also mean that the various implentations of short urls wouldn't have to be updated. I find that there are inconsistencies amongst different implementations.

    Thanks!
  • Posted: 06.12.2004, 16:17
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I have altered the file bbcode.php to accept photoshare image paths. You can find this file in the includes directory in your PNphpBB2 folder.

    I am sharing this without any warranty. Any damage to your installation or site is not my responsibility.

    In bbcode.php find the following around line #296:

    Code

    $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpe|jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\1' . str_replace(' ', '%20', '\3') . '[/img:$uid]'", $text);


    and replace with this:

    Code

    $text = preg_replace("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie", "'[img:$uid]\1' . str_replace(' ', '%20', '\3') . '[/img:$uid]'", $text);


    This will return the parsing of the bbcode image tag to the way it was pre PNphpBB2 1.2g.

    Please make this change with caution. Back up the bbcode.php file before making any changes. Once again, this may be a security issue so don't apply unless you absolutely have to. This may be fixed in furture versions of PNphpBB2 or Photoshare. Don't make this change without checking furture versions of these programs first.
  • Posted: 27.10.2006, 00:20
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I know this is a really old topic, but I'm actually looking to do exactly this. I've made this change in my bbcode.php file and indeed it's no longer just showing the URL and it's trying to show an image... but it keeps just showing a broken image link. If I paste the same URL into my browser, it does indeed show the image properly so I know I'm using the right link formatting.

    My guess is that some change has been made between PNphpBB2 1.2g and 1.2i-patched (which I am using). Has anyone been able to pull this off with the new version of the forum?

Template courtesy of Designs By Darren.