WordPress.org

Ready to get started?Download WordPress

Forums

Preview picture in upload window. (7 posts)

  1. macewan
    Member
    Posted 10 years ago #

    Hello everyone. Made a change to the b2upload.php so that the image being uploaded can be previewed. The width and height is also grabbed and added to the code that is fed back to the post page.

    if ( ereg('image/',$img1_type)) {
    list($width, $height)=getimagesize("/your/path/to/images/$img1_name");
    $piece_of_code = "<div align="center"><img src="$fileupload_url/$img1_name" border="0" width="$width" height="$height" alt="$imgdesc" /></div>";
    } else {
    $piece_of_code = "$imgdesc";
    };
    ?>
    <form>
    <input type="button" name="close" value="Now add the code to your post" class="search" onClick="targetopener('<?php echo $piece_of_code; ?>')" style="margin: 2px;" />
    </form>
    <?php echo "<img src=\"$fileupload_url/$img1_name\" border=\"0\" width=\"$width\" height=\"$height\" alt=\"$imgdesc\" />
    "; ?>

  2. southerngal
    Member
    Posted 10 years ago #

    That's a great hack, thanks for sharing. :) I can see the picture preview when I go to select the picture to upload.

  3. jackiefg
    Member
    Posted 10 years ago #

    I've obviously missed something here - I tried replacing existing code with this code and it first told me that it was looking for a ' - so I put back the old one. I tried replacing code again and then it told me there was a parse error.
    Am I supposed to replace code with this code or am I just supposed to add this code in somewhere.
    I am php illiterate.

  4. macewan
    Member
    Posted 10 years ago #

    b2upload.txt is the complete file.
    make sure you are using the correct path also. look at your existing code just to make sure.

    /path/to/your/images/images/$img1_name


    /home/fred/public_html/images/$img1_name

  5. jackiefg
    Member
    Posted 10 years ago #

    That's a great hack, I've put it in place and (after changing my path, duh) it works great!

  6. dulcechick
    Member
    Posted 9 years ago #

    so where is that b2upload.txt? I'd like to try it...

  7. Nick Momrik
    Member
    Posted 9 years ago #

    There hasn't been a b2upload.php file in WP since the days of version .7x, which was months ago!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.