Posted by ardas on July 24, 2008 at 4:52pm
| Project: | Inline |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
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.
| Attachment | Size |
|---|---|
| inline-imagecache.patch | 1.79 KB |
Comments
#1
This won't fix in 5.x-1.x, but would be a valuable addition for inline_upload module in 2.x (Inline API).
#2
Subscribe
#3
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.
#4
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.
#5
tony, this is without changes to syntax? So your inline tag still looks something like:
[inline|file=01.jpg|title=some text] ?
#6
Yes, except inline_upload instead of inline.
#7
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.
#8
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
tag disappears after I apply this patch (well, technically, it's replaced by the imagecache preset name, in this case, "300".)
#9
I have the same behavior. Subscribing.
#11
Subscribing
#12
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.
#13
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_presetandinline_upload_full_presetvariables).The patch makes also possible to control the image position in the text by introducing the
positionparameter:[upload|file=image.png|preset=small|position=center]Available positions are
left,centerandright. Such a filter will produce the following HTML code:<div class="inline-upload image-position center">...image...
</div>
No default CSS is provided.
#14
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.