Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: bbcode, <img>, and url generation?

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yeah, that's a good idea, although you'd have had to have done
    Code:
    <?php echo($pic); ?>
    or similar.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #12
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    yeah you could have done that, taht would have been easier but i wnet with the difficult function...

  3. #13
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    w00t this ones nice that i just made like in 20 seconds using my original untested script, so I made a succesful one without testing... this ones nice though...

    Code:
    <?php
    $pic = $_POST['pic'];
    $htm = $_POST['htm'];
    $bbc = $_POST['bbc'];
    
    ?>    
    <img src="<?php echo($pic); ?>"><BR><BR>
    <form name="changepic" action="" method="post">
    <input name="pic" size="50" type="text" id="pic" value="<?php echo($pic); ?>"><BR>
    <input type="submit" name="Submit" value="Submit"><BR>
    <input name="htm" size= "50" type="text" id="htm" value="<img src='<?php echo($pic); ?>'>"><BR>
    <input name="bbc" size= "50" type="text" id="bbc" value="[img]<?php echo($pic); ?>[/img]">
    </form>
    test it on
    http://michael.hungerford.us/imgtransfer.php

    this one lets you click submit after entering img location on first field, then click submit and it refreshes and puts a preview of the image, the location in the first field, the html version in the second field, and the third field is the bbcode.

    This is the first php script I've ever just writeen and it worked on my own, so Im pretty happy about this.

  4. #14
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    Updated version!

    Code:
    <?php
    $pic = $_POST['pic'];
    $htm = $_POST['htm'];
    $bbc = $_POST['bbc'];
    
    ?>
    Image Preview:<BR>
    <HR WIDTH="100%" SIZE="1" ALIGN="Left" NOSHADE COLOR="#000000">
    <img src="<?php echo($pic); ?>"><BR>
    <HR WIDTH="100%" SIZE="1" ALIGN="Left" NOSHADE COLOR="#000000"><BR>
    <form name="changepic" action="" method="post">
    Picture Location: <input name="pic" size="50" type="text" id="pic" value="<?php echo($pic); ?>">
    <input type="submit" name="Submit" value="Submit"><BR><BR>
    HTML code: <input name="htm" size= "50" type="text" id="htm" value="<img src='<?php echo($pic); ?>'>"><BR>
    BBcode: <input name="bbc" size= "50" type="text" id="bbc" value="[img]<?php echo($pic); ?>[/img]">
    </form>

  5. #15
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Just remember to strip HTML.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  6. #16
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    Code:
    <?php
    $pic = $_POST['pic'];
    $htm = $_POST['htm'];
    $bbc = $_POST['bbc'];
    
    ?>
    Image Preview:<BR>
    <HR WIDTH="100%" SIZE="1" ALIGN="Left" NOSHADE COLOR="#000000">
    <?php
    if ($pic !=""){
    ?>
    <img src="<?php echo($pic); ?>">
    <?php
    } else {
    ?>
    <?php } ?>
    <BR>
    <HR WIDTH="100%" SIZE="1" ALIGN="Left" NOSHADE COLOR="#000000">
    <form name="changepic" action="" method="post">
    Enter an image's location and this will convert it to HTML code and BBcode.<BR><BR>
    Picture Location: <input name="pic" size="50" type="text" id="pic" value="<?php echo($pic); ?>">
    <input type="submit" name="Submit" value="Submit"><BR><BR>
    <?php
    if ($pic !=""){
    ?>
    HTML code: <input name="htm" size= "50" type="text" id="htm" value="<img src='<?php echo($pic); ?>'>"><BR>
    BBcode: <input name="bbc" size= "50" type="text" id="bbc" value="[img]<?php echo($pic); ?>[/img]">
    <?php
    } else {
    ?>
    HTML code: <input name="htm" size= "50" type="text" id="htm"><BR>
    BBcode: <input name="bbc" size= "50" type="text" id="bbc">
    <?php } ?>
    </form>
    tells description, and img preview... also hides the <img scr=''> and [omg][/img] in fields when the first field is empty

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •