Closed (fixed)
Project:
Responsive images and styles
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Jun 2012 at 03:48 UTC
Updated:
4 Jan 2014 at 02:05 UTC
Jump to comment: Most recent
Comments
Comment #1
jelle_sHow are you inserting the images in to this field? Is it through an external url? Because if it is, it won't work. It works best using the Media Module.
Comment #2
sinagod2 commentedHi Jelle_S,
Thank you for your quick reply.
I was inserting the images into the body field using the IMCE Bridge plugin for the TinyMCE editor with the wysiwyg api. When inserted this way it generated the standard html img tag with an absolute URL.
The image shows up but it's not responsive.
I did like you suggested and added the images using the media module's media browser and I get this code inserted before the standard html tags with a relative URL.
[[{"type":"media","view_mode":"media_responsive","fid":"10","attributes":{"alt":"","class":"media-image","typeof":"foaf:Image"}}]]
Now the image shows up and it is responsive.
Moreover, it generated a image for each of the image styles I set up.
Could you explain the syntax of that code.
Is this being passed to the responsive images and styles module and then generating the html code?
Thanks for your help
Comment #3
jelle_sNo, the media module generates the HTML Code. All we do is in hook_entity_view_alter we do a regex search for images and replace the image style in the url (image styles get their own folder, so we can replace that folder with the folder of the style corresponding to the current width of the screen).
I hope this helps, feel free to aks any questions you might still have ;-)
PS: You can find the code here
Comment #4
attiks commentedComment #5
attiks commented