Greetings,

I would like to propose you a patch which implements an ability to specify imagecache preset inside inline tag instead of just having one global setting for all tags.

This patch doesn't break existing functionality but now a user can use imagecache preset inside inline tag. This will give an ability to use various presets depending on images.

Usage:
with title [inline:image-file-name.jpg=Image Title=preset-name]
without title [inline:image-file-name.jpg==preset-name]

The patch was created against the latest 5.x-1.x-dev release. Please review and consider to apply it to both 5.x-1.x-dev and 5.x-2.x-dev branches.

Thank you.

Comments

sun’s picture

Title: Using imagecache preset inside inline tag » Allow to define ImageCache preset per inline tag
Version: 5.x-1.x-dev » 5.x-2.x-dev
Status: Needs review » Needs work

This won't fix in 5.x-1.x, but would be a valuable addition for inline_upload module in 2.x (Inline API).

tonycpsu’s picture

Subscribe

Bryan76’s picture

Version: 5.x-2.x-dev » 6.x-2.x-dev
StatusFileSize
new1.83 KB

I have patched the latest HEAD of 6.x-2.x-dev to allow for inline imagecache preset override. The new format is:

[inline|file=01.jpg|title=Some Title|imagecache=alternative-preset]

If the imagecache parameter is not set, it will fall back to the default.

tonycpsu’s picture

After applying this patch, I no longer see the image inline -- just the title of the image linked to the image file. This is with no changes to the syntax. If I reverse the patch, I get the images showing up in the nodes again.

Bryan76’s picture

tony, this is without changes to syntax? So your inline tag still looks something like:

[inline|file=01.jpg|title=some text] ?

tonycpsu’s picture

Yes, except inline_upload instead of inline.

Bryan76’s picture

Whoops, mine is also. For a moment there I thought "Wait.... how did I code my inline tags."

Are you certain that w/o the imagecache parameter [inline_upload|file=01|imagecache=tiny-preset] That it is still using imagecache and not just displaying the default image?

Upload an image, check the url that is displayed directly under the description down in the "file attachments" section of the node edit. Then insert it using [inline_upload|file=filename.jpg]. When the image is properly displayed in-line, right click on it and select view image. Verify that the image is coming from a directory such as: http://yoursite.com/sites/all/files/imagecache The important item is "imagecache" if you don't see that in the path, then imagecache isn't being used, and you have something to troubleshoot before trying to do a parameter override of the imagecache preset.

If it is properly displayed let me know. I'll do a fresh drupal install and see if I can get my patch to work or not.

tonycpsu’s picture

Yes, it looks to me like it's the imagecache image that's being served. Here is what the HTML source before I apply this patch:

<a href="/sites/site.example.com/files/luau.jpg" class="inline-image-link" title="View: Luau"><img src="http://site.example.com/sites/site.example.com/files/imagecache/300/luau.jpg" alt="Luau" title="Luau"  class="inline" width="300" height="212" /></a>

and here's what it looks like after the patch:

<a href="/sites/site.example.com/files/luau.jpg" class="inline-image-link" title="View: Luau"><img src="http://site.example.com/sites/site.example.com/files/imagecache/300/300" alt="Luau" title="Luau"  class="inline" /></a>

Notice, the filename of the Only local images are allowed. tag disappears after I apply this patch (well, technically, it's replaced by the imagecache preset name, in this case, "300".)

dquakenbush’s picture

I have the same behavior. Subscribing.

srobert72’s picture

Subscribing

NoRandom’s picture

ardas, I really would like to choose wich imagecache preset to apply but I think it should be in a simpler way. Since you should only need a couple of presets for inline images I would go for some kind of symbol at the end of the inline tag. For example:

[inline:file.jpg*] would launch preset one.
[inline:file.jpg**] would launch preset two.
...and so on.

Regards.

ademarco’s picture

Title: Allow to define ImageCache preset per inline tag » Allow to define ImageCache preset and image position per inline tag
StatusFileSize
new4.41 KB

A slightly modified version is attached, it allows to apply an Imagecache preset to the inline image by using the following syntax:

[upload|file=image.png|preset=small]

Specifying a preset overrides the global ones (those fetched from inline_upload_teaser_preset and inline_upload_full_preset variables).

The patch makes also possible to control the image position in the text by introducing the position parameter:

[upload|file=image.png|preset=small|position=center]

Available positions are left, center and right. Such a filter will produce the following HTML code:

<div class="inline-upload image-position center">
  ...image...
</div>

No default CSS is provided.

ademarco’s picture

Fix for #13: check preset existence by name and not by array key. It also prints an error message in case the specified preset was not found.