When inserting an image at the original size, it is not recognized as a standard size by the img_assist filter.
This patch checks the requested image size against the original size before trying to derive whether it should use the preview or thumbnail sizes or create a custom size.

Comments

zoo33’s picture

This seems like a valid point although I haven't tested this myself.

I checked the patch and it's a little hard to read because of the whitespace changes. I suspect that the only real change is this part:

<?php
      $original_size = image_get_info(file_create_path($node->images['_original']));
      if ($width == $original_size['width'] && $height == $original_size['height']) {
        // Nothing to process, this is the original image size
        $closest_std_size = '_original';
        $create_custom = false;
      }
      else {
?>

Am I right? I'm not sure how this is usually handled, but could you perhaps make a new patch without the whitespace changes (like I did with the Drupal 5 compatibility patch)?

One small issue is the comment immediately above this code snippet ("Get the width & height...") which appears twice after applying this patch. The first occurrence in said location should be removed.

Someone else willing to do some testing and reviewing?

moonray’s picture

Attached is the same patch without any whitespace changes, and the comment (see previous post) changed.

waltervn’s picture

After applying this patch inserting an image with original size works, but only if I choose the "HTML Code" mode. Choosing "Filter Tag" still results in a thumbnail.

Any help would be appreciated.

moonray’s picture

Make sure you're not seeing a cached version of the page (I had this at first as well). Best way to do that is to empty the cache table in the database. I think the devel module allows you to empty the cache as well.
Alternatively you can change some of the text in the node.

If that's not it, let me know, I'll try looking into it.

waltervn’s picture

After clearing the cache with the Devel module it's working now. :) Thanks a lot for the patch!

zoo33’s picture

Status: Needs review » Reviewed & tested by the community

Great! I'll commit this as soon as I can.

zoo33’s picture

Committed. Thanks moonray!

zoo33’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)