Support » Plugins » Preview picture in upload window.

  • macewan


    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";
    <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;" />
    <?php echo "<img src=\"$fileupload_url/$img1_name\" border=\"0\" width=\"$width\" height=\"$height\" alt=\"$imgdesc\" />
    "; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • southerngal


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



    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.



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



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

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

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Preview picture in upload window.’ is closed to new replies.