WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Image uploading WP 2.0 (32 posts)

  1. incredipete
    Member
    Posted 8 years ago #

    Alright, I've seen the threads on this topic, and they just don't seem to get to the issue.

    When I upload an image, I want to show the image full size. I'm not an idiot, I don't need wordpress to do thumbnails, resize my images, or in any other way modify them. I just want to insert the code to show the the image at it's actual size.

    We need a fix that will allow insertion of the img src code without adjusting the height or width attributes.

    Someone make it go away!

  2. Kafkaesqui

    Posted 8 years ago #

    As I've just noted elsewhere, if you toggle "Using Thumbnail" to "Using Original" and send the image to the editor, does this not insert the full size image, un-widthed and un-heighted?

  3. thugparlay
    Member
    Posted 8 years ago #

    No, it still inserts a 'thumbnail' version of the 'original size' of the image there. You can click, then drag the image so that it's eventually the original size....

    But what he/she wants is the original image size inserted, no ifs no buts.

  4. Kafkaesqui

    Posted 8 years ago #

    See this post:

    http://wordpress.org/support/topic/56972#post-308980

    Are you dragging the images into your edit form, or are you selecting "Send to editor?"

    EDIT: Note that I'm attempting to verify if this is a problem in 2.0 which is (or rather, will be) fixed in 2.0.1. Just read further on in the linked-to thread...

  5. jaybarrow
    Member
    Posted 8 years ago #

    Same issue here. No matter which I choose, I get the same code. I'm not dragging anything anywhere.

    If I choose "Using Original" and then "Send to editor", the code inserted is for a smaller size, not original size.

    If I choose "Using Thumbnail" the code is the exact same. The image specified is not for the thumbnail version. If I delete the width/height attributes of the inserted code I see the original (large) image size without distortion/pixellation.

    There are 2 versions of the image created in my uploads directory: image.jpg, and image.thumbnail.jpg. No matter what combination I use, I generate no "thumbnail" code. Yet the dimensions would specify otherwise.

    I get the same results regardless of OS/Browser. Is this a glitch in WP 2.0? Tell me which file to hack and I'll fix it myself.

  6. incredipete
    Member
    Posted 8 years ago #

    Exactly, jaybarrow. Whether I click "Using Original" or "Using Thumbnail" I get code that includes a height attribute, which is set to thumbnail size. However, it is using the original image, which makes even less sense.

    My images are ready to go full size. I don't need WP making an arbitrary size adjustment for me, and I'm not good enough to hack the code.

    Anybody that comes up with a fix that will allow insertion of a basic "img src" line for the original image without adjustment of the size will get mad-respect from me and from the dozens of other users struggling with the same thing.

  7. jaybarrow
    Member
    Posted 8 years ago #

    I managed a work-around:

    Save a backup copy first. Use BBEdit, TextWrangler or something that shows line numbers.

    The inline-uploading.php file edits:

    Lines 237, 238, and 242: Remove the $height_width string. Save and re-upload.

    This removes the height/width attributes of the IMG tags.

    I'm sure this isn't compliant code but it works for me. I would rather have the correct height/width attributes in the code, but have only managed to get the original fullsize attributes. To get those, make this edit INSTEAD:

    Line 231:

    Change $image['uheight'] and $image['uwidth'] by removing the "u" character to read $image['height'] and $image['width']. And don't edit lines 237, 238 and 242. You'll get the fullsize height/width attributes for both thumbnails and original image.

  8. incredipete
    Member
    Posted 8 years ago #

    Thanks jaybarrow. Good hack!

  9. incredipete
    Member
    Posted 8 years ago #

    As far as I'm concerned, jay's hack was exactly what the doctor ordered. I'm marking this thread as resolved. (For the record, the line numbers were off by two because I had already applied another fix that was posted on the track-diff thread.

  10. preset
    Member
    Posted 8 years ago #

    Hello,

    I starred a long time at inline-uploading.php and this is my hack:
    http://shutdown.preset.de/web-development/2006/01/upload-feature-20-hack/

    This way the correct pixel sizes are inserted for both thumbnails and original image.

    please let me know if it works for you, too!

    regards

    rdg

  11. incredipete
    Member
    Posted 8 years ago #

    Thanks for your effort, preset... it seems to work well!

  12. Gunter
    Member
    Posted 8 years ago #

    Very nice! Works very well!

  13. incredipete
    Member
    Posted 8 years ago #

    I don't know if anyone else noticed, but if you're a fan of the old upload window, there's a plugin to add it back in... You'll find it at

    http://wp-plugins.net/plugin/filosofo-old-style-upload/

    I've already tested it, and it works great.

  14. dito199
    Member
    Posted 8 years ago #

    Good work. I have been struggling with this image upload function since day 1 and I always ended up doing this for every image:

    1. check the actual image dimension
    2. open html pop up
    3. enter manually the dimension

    This saves the day. I vote for this to go into the next WP revision.

  15. incredipete
    Member
    Posted 8 years ago #

    Amen. (Matt, the masses have spoken!)

  16. danl
    Member
    Posted 8 years ago #

    is there a way with the WP 2.0 uploader to not generate thumbnails?

  17. boneless
    Member
    Posted 8 years ago #

    OK, this plugin really works, finally the uploads work again, thanks!
    http://wp-plugins.net/plugin/filosofo-old-style-upload/

  18. petit
    Member
    Posted 8 years ago #

    Kaf and all:
    This *is* a frustrating problem in WP 2.0, which I hope will be fixed in a fix up version in the near future.
    Who ever crafted the upload and include in post engine, did a great job, but a too fancy solution.
    o It is unintuitive and error prone. It is very difficult to understand how to include the full size image and have it presented full size.

    Other things to wish for:
    o It would be much better to have radio button for the options, that are now overlayed on the thumbnail in the upload form.

    o The upload itself creates new folders for every date.

    The rational for this is easy to understand ( the image is itself a kind of post, that may have its own comments, and you get automatic structure and upload history ), but many bloggers want control over where to upload images.

    o The upload folders are created by the the web server user, and at least on some server hosts this means the user can not change or delete or even open the folders.
    The owner of upload folders at my web hotel is "nobody", an alias for the web server ( or PHP engine ), and I cannot even open the folders.

    I love WP 2.0 and will continue using it and learning how to fine tune it.

  19. marchern
    Member
    Posted 8 years ago #

    hello, i'm a amatuer at this, and this thread has made things so much easier for me. thank you.

    i have succeed into showing images at their original size. i want to confirm if what i did (after interpreting what was written above) was correct, and if i did anything extraneous.

    other less technologically inclined participants could also read the following steps and the comments that follow for a detailed description on HOW.

    for those more technologically inclined, do comment on the following steps to allow images to be shown at their original size. i know it's not the best way, and your comments would help a burgeoning strata of wordpress users like me : )

    here goes:

    1) find inline-uploading.php at htdocs/wp-admin/inline-uploading.php
    2) open it in notepad and replace the content with what preset has provided on this page: http://proforma.preset.de/wordpress/inline-upload/rdg_inline-uploading.php.txt
    3) now, upload the image as you would your wordpress admin panel. after uploading, drag the pic into the textbox where you usually write your posts. the image will be resized.
    4) next, click on the HTML icon to edit the html code. a new window will open up.
    5) in the code, change three things: a) change image.thumbnail.jpg to image.jpg; b) change the height="xyz" to the original height; c) change the width="zyx" to the original width.

    that's it. comments pls.

  20. preset
    Member
    Posted 8 years ago #

    marchern,
    if you want to drag'n'drop the images to the editor, my solution isn't the right one for you.
    I changed the original source *not* to change the thumbnail to be draged to the editor in the right size.

    In a previous stage of hacking the file the thumbnail changed its dimensions when choosing 'use thumbnail'/'use original'.

    I think the original version of inline-uploading.php is a mixture of 'use the pop-up menu' and 'drap'n'drop' the image.

    rdg

  21. gsxr-team
    Member
    Posted 8 years ago #

    Hello,

    First I have to admit that my english is verry bad
    Soo, I hope you can understand what I try to say.

    I have downloaded filosofo-old-style-upload.php
    But....

    where do I have to place it afther unpacking ??

    Sorry, Iàm blondttt i gess (gniffff)

  22. gsxr-team
    Member
    Posted 8 years ago #

    oke, I just find out !

    It works great !!!!!!!!

  23. FC
    Member
    Posted 8 years ago #

    Hi everyone,

    After I had updated my blog to WordPress v2.01, I encountered the same problem as anyone here: i.e. as I wanted to upload the original image (original size) in the editor, WordPress automatically switched it to the thumbnail size (128x96 px). Such a disobedience!

    Based on the posts in this support forum, I found out that you can manually adapt this "disobedience" by using the HTML-editor (icon: HTML). If you selected the original image in thumbnail format and then clicked the HTML-icon, a pop-up appeared with the source code. You only had to delete the heigth-tag, and the thumbnail immediately changed in the original sized image.

    Now, this process is quite embarrasing. It would be much better if the upload image browser did this automatically. And after some experimenting, I finally discovered the solution!

    1. Make a back-up of "inline-uploading.php" (you'll find this in the wp-admin/ folder)

    2. Then, download the "inline-uploading.php"-file and open it with a text editor, such as Notepad.

    3. Use 'find' and search on "<img id=\" => you will find this tag for three times in the whole document.
    Now at the end of the line that begins with "<img id=\" you'll find "$height_width". DELETE this (also 3 times).

    240 imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />';
    241 imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$title}\" $height_width />';
    242 ";
    243 $html .= "<div id='target{$ID}' class='attwrap left'>
    244 <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
    245 <img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />

    4. Save the "inline-uploading.php"-file and upload it to the wp-admin/ folder.

    5. You're done! When you choose to upload an image in its original size, WordPress will obey you and it will execute your command in the right way.

    Ciao

    Filip

  24. mictieson
    Member
    Posted 8 years ago #

    o.k. this is what i have discover thus far, the upload "USING THUMBNAIL" and "USING ORIGINAL" option DOES NOT WORK IN INTERNET EXPLORER. I actually have to freaking load FIREFOX onto every customers computer just so they can use the image feature on the sites.

    This is jacked up, I love wordpress but wish they would have tested it on various IE version before finishing it, one of my clients has a computer only 3 months only and can't upload with thier new ie, I'm tired of telling clients to "Browser Hop" to use thier websites. Everything works good except that one thing, which is more then I can say for mambo, 4 images, movable type, and all the other stuff I have used, now if only someone could create a Template with a horizontal nav-bar that works on multiple browsers (i'm tired of my menues dropping to the bottom right side of the page.)

  25. jaybarrow
    Member
    Posted 8 years ago #

    I thought I'd read somewhere that the original image dimensions were fixed in the 2.0.1 update. Just installed it and it appears it isn't. Of course, I've only tested it in Mac Safari and Firefox. When inserting image code from the inline-uploading frame, I get decent code, excluding height/width attributes (which I'd previously hacked out of the 2.0 version). I guess I read wrong and the quirk is still there?

  26. vegardjo
    Member
    Posted 8 years ago #

    I am experiencing similar problems with WP 2.02:

    if chosing "send to editor" in Firefox, the image (original size) is inserted. this is the way I want it to be.

    if doing the same from IE, the *thumbnail* of the image is inserted. why oh why?

    I do not have the option "using original / using thumbnail" mentioned above at all.

    any ideas how to have this work the same way for all browsers?

  27. chalfantgetzappedcom
    Member
    Posted 8 years ago #

    This is what I found when exploring why the "Send to editor" option does not work in IE:

    In IE, for some reason the width and height tags' values do not have quotation marks around them. In not-IE browsers, the image tag looks like

    <img width="79" height="128"...>

    but in IE it looks like:

    <img width=79 height=128

    Solution:
    There is a function named sendToEditor in wp-admin/inline-uploading.php. This funcion tries to modify the img tag before sending it to the editor, but the regexp that removes the width and height attributes looks for quotation marks around the values. This is the code that worked for me:

    h = h.replace(new RegExp(' (width|height)="?\d*"?', 'g'), ''); // Drop size constraints

  28. mihaigrigori
    Member
    Posted 7 years ago #

    I'd say this would be a little better:

    h = h.replace(new RegExp(' (width|height)=([0-9])+"?\d*"?', 'g'), ''); // Drop size constraints

    h = h.replace(new RegExp(' (width|height)="?\d*"?', 'g'), ''); // Drop size constraints
    would leave the width,height attributes values floating around..
    e.g. <img id='image23'89 alt='....

    I'm using WP 2.04 right now.

  29. thesheep
    Member
    Posted 7 years ago #

    I also find these Regular Expressions are not working properly at all in IE.

    First of all, the following line has some problems:

    h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]+)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes

    For one thing, the second group is set to continue until it reaches a space. But this does not cover the case where the attribute is right at the end of the tag, in which case the attribute should end with a >.

    Also this RegExp doesn't deal with the attributes 'alt' and 'rel'. These are easy to add.

    So this line becomes:

    h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown|alt|rel)=([^\'"][^ >]+)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes

    This works better, but strangely it is still not catching all attributes in IE. In particular id=p123 does not get changed into id="p123". Can someone tell me why? So I simply added an extra RegExp to deal with this:

    h = h.replace(new RegExp('id=(p[0-9]+)', 'g'), 'id="$1"');

    Incidentally if you are fiddling around with this code, trying to get the RegExp to work, it's useful to put in some lines like this above and below the expression you're trying to debug:

    alert('h is ' + h);

    and that will help you see what is going on.

  30. paulrpayne
    Member
    Posted 7 years ago #

    Here's the regular expressions that work for me:

    To enclose all attributes in quotes:
    h = h.replace(new RegExp('=([^\'"][^ >]+)', 'gi'), '="$1"');

    To remove height/width attributes:
    h = h.replace(new RegExp(' (width|height)="([0-9])+"', 'gi'), '');

Topic Closed

This topic has been closed to new replies.

About this Topic