• Dear all,
    after several attempts and searches here and on the entire web, I am starting this post:
    Being a photographer, I want to switch OFF wp’s (3.4.2) feature to process jpgs after upload, as I am doing this a lot more efficient myself.
    I started worrying about that in particular, when wp started giving me memory allocation error codes “out of memory…media.php on line 258” when uploading larger images (above 250kb jpgs).
    Even working around the standard media uploader with the “add from server”-plugin, I still receive that error (cause wp is still crunching?!), so I simply need to switch that compression feature off completely, I guess.

    Any ideas?

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Phil

    (@owendevelopment)

    Have you tried improving image quality of resized images via the functions.php file (BACKUP this file before trying):

    function ajx_sharpen_resized_files( $resized_file ) {
    
        $image = wp_load_image( $resized_file );
        if ( !is_resource( $image ) )
            return new WP_Error( 'error_loading_image', $image, $file );
    
        $size = @getimagesize( $resized_file );
        if ( !$size )
            return new WP_Error('invalid_image', __('Could not read image size'), $file);
        list($orig_w, $orig_h, $orig_type) = $size;
    
        switch ( $orig_type ) {
            case IMAGETYPE_JPEG:
                $matrix = array(
                    array(-1, -1, -1),
                    array(-1, 16, -1),
                    array(-1, -1, -1),
                );
    
                $divisor = array_sum(array_map('array_sum', $matrix));
                $offset = 0;
                imageconvolution($image, $matrix, $divisor, $offset);
                imagejpeg($image, $resized_file,apply_filters( 'jpeg_quality', 90, 'edit_image' ));
                break;
            case IMAGETYPE_PNG:
                return $resized_file;
            case IMAGETYPE_GIF:
                return $resized_file;
        }
    
        return $resized_file;
    }   
    
    add_filter('image_make_intermediate_size', 'ajx_sharpen_resized_files',900);
    Thread Starter peter_100

    (@peter_100)

    Hi Phil,
    thank you, your suggestion won’t solve my initial problem of good image quality (200-300 kb jpgs 1200×1600 or so sized sharpened to the point in photoshop…) that cause the WP crunching process to run out of memory.
    I am trying to get rid of all the automatism instead but cannot find where to switch it off.

    Phil

    (@owendevelopment)

    Have you tried increasing PHP memory limit in your server? Check your php.ini file to see what it is set as and try increasing it to 256M or 512M. I’ve had issues before when it was set at 32M by default. Rather than modifying WordPress core files (which will only reappear when you update WP), try tackling this from the other way.

    32M is the absolute minimum for a WP 3.4.2 site. and then only if you have zero plugins, run something like Twenty Eleven and don’t upload larger images (eg over about 100k). Ideally you should have at least 64M memory.

    Thread Starter peter_100

    (@peter_100)

    looks like that is my issue 🙁

    Thanks Esmi

    Phil

    (@owendevelopment)

    ?

    I think it was Phil that first suggested that it could be a memory issue. I just had some hard numbers that I thought might help 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Disabling image crunching???’ is closed to new replies.