WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] HTTP Error on image upload after upgrade to 3.5 (28 posts)

  1. B_Dark
    Member
    Posted 1 year ago #

    I deactivated all of my plugins and I still have this problem!!! Why this happen with the new version ONLY?! If is in some themes the problem plz somebody the solution!!!

    After I upgraded the wp to 3.5, i can’t upload any photo! I am getting http error on the post every time I upload a image, and on “media>add new” it freezes on 100%.

    http://img201.imageshack.us/img201/8166/httperror.jpg

  2. B_Dark
    Member
    Posted 1 year ago #

    Also, if i try to upload photo via browser uploader i get

    503 Service Unavailable

    The server is temporarily busy, try again later!
    Powered By LiteSpeed Web Server
    LiteSpeed Technologies is not responsible for administration and contents of this web site!

  3. B_Dark
    Member
    Posted 1 year ago #

    This is my functions.php of my theme can you tell me where is the problem?

    I started uploading many photo sizes, at first I thought that it uploads without any http error those that were smaller in size. So, I compressed to a smaller size photos with big dimensions and it kept having http error. So I decided to upload photos with different dimensions and I saw the problem is with the dimensions of images.. specific any photo over than 511(width) i got http error , and any image uploaded less than 511(width) didn’t had any http error.
    So with simple logic thinking, the premium theme have incompatibility with wordpress 3.5 with the photo dimensions when you are uploading.

    [Excessive code moderated. Please use a pastebin]

  4. B_Dark
    Member
    Posted 1 year ago #

  5. B_Dark
    Member
    Posted 1 year ago #

    Please someone help me, I've tried everything!

  6. Andrew Bartel
    Member
    Posted 1 year ago #

    Sorry no one had a chance to help you before, did you try it with the 2012 theme activated or have you checked to see if your theme has released an update? 3.5 is much more strict about some javascript rules and caused some sites to break.

  7. B_Dark
    Member
    Posted 1 year ago #

    hi Andrew Bartel,
    "did you try it with the 2012 theme activated " I do not understand what do you mean.

  8. B_Dark
    Member
    Posted 1 year ago #

    yes i have check and says me is ok with 3.5. but in my case i have problems with the theme and wp 3.5

  9. B_Dark
    Member
    Posted 1 year ago #

    We find the problem , the problem is on

    line 131
    add_image_size('theme-thumb', 520, 497, true);

    lines 267-275

    if (function_exists('add_theme_support')) {
        add_theme_support('post-thumbnails');
        set_post_thumbnail_size(150, 250); // default Post Thumbnail dimensions
    }
    
    if (function_exists('add_image_size')) {
        add_image_size('post-thumb', 310, 9999); //300 pixels wide (and unlimited height)
        add_image_size('widget-thumb', 220, 180, true); //(cropped)
    }

    When we took them off it didn't show any "HTTP error" when we uploaded a photo on media.

    on function.php of Twenty Twelve
    use

    // This theme uses a custom image size for featured images, displayed on "standard" posts.
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop

    without giving any "HTTP error"

    is strange, do you know why is this happening? And how can I fix it?

  10. breotch
    Member
    Posted 1 year ago #

    This is the exact issue I am having. Did you find a solution?

  11. B_Dark
    Member
    Posted 1 year ago #

    not yet :/

  12. breotch
    Member
    Posted 1 year ago #

    For me it appears to be this line in particular:

    add_image_size( 'recent-posts', 98, 119, true );

    When I changed it to 100 pixels, it works again.

    add_image_size( 'recent-posts', 100, 119, true );

    edit: I have about 5 other add_image_size functions that work perfectly, just this one was giving me trouble.

  13. B_Dark
    Member
    Posted 1 year ago #

    i don't know why any of the wordpress developer team they haven't answer yet, i think only them know the solution for this issue

  14. iammkstevens
    Member
    Posted 1 year ago #

    Hey,

    Ran into the same issue... did troubleshooting for the last several hours until I finally landed on the post thumbnail section in my functions.php being the issue. I wish I had a complete solution here, but I don't, and I'm wondering if for some people if it's a bug with their theme, or something that is messed up in WordPress 3.5.1...

    Let's just say I did the most common sense things that are told to everyone on how to solve problems... ie deactivate/activate plugins, re-install the version of wordpress, etc. I went through and checked my javascript and jquery that I have manually installed (deleted the enques, uploaded image and got the same result as always: http error).

    I figured it's something to do with my theme because the 2012 theme works wonderfully. Finally I deleted everything in functions.php. I then uploaded an image and it worked perfectly. From there, I went through trial and error of deleted each different section and then uploaded an image, but to no avail, still the same "http error": jquery, navigation, sidebars, shortcodes didn't work, until I got to post thumbnails... and this is where I am now...

    here is what my code looks like (this is what I believe causes the http error for me):

    // Featured Thumbnails
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 210, 210 );
    add_image_size( 'featured', 260, 260, true ); // Located on FRONT PAGE
    add_image_size( 'quicks', 160, 160, true ); // Located on FRONT PAGE

    Because when I take away the "true" in the add_image_size, everything uploads fine and no error.

    // Featured Thumbnails
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 210, 210 );
    add_image_size( 'featured', 260, 260 ); // Located on FRONT PAGE
    add_image_size( 'quicks', 160, 160 ); // Located on FRONT PAGE

    The solution of taking out the "true" would be fine if this was just my site, because I don't mind cropping images to fit properly, but I don't expect any clients to do the same. I'd much rather them be able to upload an image of any dimension and have wordpress crop it for them... isn't that what makes wordpress (and other CMS' special?).

    I'm wondering if this is the same issue that you guys are having, and if there have been any luck finding solutions. Would love to get to the bottom of this.

  15. esmi
    Forum Moderator
    Posted 1 year ago #

    Please post your own topics. Posting in an existing, resolved, topic actually prevents us from being able to track issues by topic. Added to which, your problems - despite any similarity in symptoms - may be completely different.

  16. iammkstevens
    Member
    Posted 1 year ago #

    Okay... my apologies... was just trying to help with whatever info I could.

  17. breotch
    Member
    Posted 1 year ago #

    My solution above ending up not working out. It turns out downgrading my version of PHP from 5.3 to 5.2 fixed the issue.

  18. houseofstrauss
    Member
    Posted 1 year ago #

    Having identical http error messages on 3.5.1 Is there any definitive resolution here? Downgrading php version is not a viable option. NOTE; all images are uploaded, despite the error, switching the media options to 'images uploaded for this post' reveals the image uploaded, the one that caused the http error. So it is uploaded, despite throwing the error.

  19. jesse24
    Member
    Posted 1 year ago #

    Has anyone solved this issue yet? It rather critical.

  20. malticorn
    Member
    Posted 1 year ago #

    Hello, I solved the problem here.

    So, I have dealing with the blog of a customer that had problems uploading photos after updating to 3.5.1. He couldn't add images into posts/pages or select a feature image, because of a bug in the new media uploader.

    After debuging a little with Firebug, I found that the response in JSON of two files are not correct because of PHP Warnings.

    So, I edited those two files:
    ./wp-admin/admin-ajax.php
    ./wp-admin/async-upload.php

    And added at the beginning of each file, just after the <?php tag (top of each file):

    /**
     * Little fix to hide PHP warnings
     */
    ini_set("display_errors", 0);
    ini_set("error_reporting", 0);
    error_reporting(0);

    After this, everything works great. It just mute the PHP errors and warnings in the response of those files, and don't corrupt the JSON. If you have access to the php.ini file, you could do it from there.

    If you have not access to your files via FTP, use wp-FileManager
    http://wordpress.org/extend/plugins/wp-filemanager/

    Remember to allow download and delete files from the configuation option in the FileManager.

    Cheers everyone!

  21. esmi
    Forum Moderator
    Posted 1 year ago #

    because of a bug in the new media uploader.

    What bug? Never, ever, edit WordPress core scripts. And do not encourage others to do so. Editing core scripts can bring down your entire site and/or open security holes for hackers to use.

  22. malticorn
    Member
    Posted 1 year ago #

    Here is the response of admin-ajax.php:

    <br />
    <strong><b>Warning</b>:  in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in <b>/home/user/example.com/wp-includes/functions.php</b> on line <b>1772</b><br /></strong>
    <br />
    {"success":true,"data":[{"id":1308,"title":"IMG_0258-title","filename":"IMG_0258-title1.jpg","url":....

    Because of the HTML segment, when the Media Uploader try to parse the JSON response it get an error.

    Editing core scripts can bring down your entire site and/or open security holes for hackers to use.

    Do you know what we are editing here? We are not changing code of WP or the behaviour of how WP works, just PHP.

  23. houseofstrauss
    Member
    Posted 1 year ago #

    So, I edited those two files:
    ./wp-admin/admin-ajax.php
    ./wp-admin/async-upload.php

    Esmi is totally correct here. Keeping the integrity of the core source code it critical. If you have found a bug and/ or a way to resolve this, please inform the devs ASAP, even if it's a simple php code error.

    Thanks for spotting this, however :)

  24. malticorn
    Member
    Posted 1 year ago #

    Good to know houseofstrauss. Thanks to remind me. I really don't like to touch the core files, but it was the exception because my client has not access to the php.ini configuration, something that could solve it easily.

    Normally those kind of error doesn't should popup in production servers, but some hosting plans didn't hide the PHP reports to keep them just in the logs.

    Coming back to the error from ./wp-includes/function.php seems like the array for images doesn't exist:

    function wp_ext2type( $ext ) {
    	$ext2type = apply_filters( 'ext2type', array(
    		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
    		'video'       => array( 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
    		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'rtf',  'wp',   'wpd' ),
    		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
    		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
    		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
    		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
    		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
    	));
    	foreach ( $ext2type as $type => $exts )
    		if ( in_array( $ext, $exts ) )
    			return $type;
    }

    So, when you are uploading a image, like .jpg, WP doesn't recognise it by the extension because is not an array with image extensions in $ext2type.

    Edit
    WP 3.4 doesn't have it neither.

    It should be something like:

    ...
    'image'        => array( 'jpg', 'png', 'gif', 'bmp', 'tiff' ),
    ...

    But I don't know what is the name that WP is expecting: 'image'? 'picture'? 'photo'?

  25. houseofstrauss
    Member
    Posted 1 year ago #

    Ok, you're on the case ... can I suggest you get involved here as well
    http://make.wordpress.org/core/handbook/reporting-bugs/#reporting-a-bug

    and here
    http://codex.wordpress.org/Reporting_Bugs

    The devs will check this out through the trac system and work it through to a update if it's appropriate.

    Thank-you

  26. malticorn
    Member
    Posted 1 year ago #

    Thank so much

  27. ksonline
    Member
    Posted 1 year ago #

    Hi WordPress Forum,

    I am a huge fan of WordPress, but I found the only solution to this problem for me, after trying the suggested fixes, was to downgrade to 3.4.2. Now my image uploads work fine, and NextGen Gallery also works fine (also downgraded from the latest release).

    Maybe I missed it, but why hasn't this fairly major bug been addressed by the development team?

  28. Andrew
    Forum Moderator
    Posted 1 year ago #

    @ksonline, you can discuss that in your own thread.

Topic Closed

This topic has been closed to new replies.

About this Topic