DV-JF Posted December 21, 2012 Share Posted December 21, 2012 Hello, I wanne make my templates responsive but have a little problem with the images because the height and width are stored in the outputted code like: <img class="align_center" width="982" height="655" alt="" src="/site/assets/files/1024/start.jpg"> Is it possible to delete those attributes in the generated code by default? Greets... Jens. Link to comment Share on other sites More sharing options...
Luis Posted December 21, 2012 Share Posted December 21, 2012 By default Processwire doesn´t generate any markup. Could you please provide us more information about your site setup? Do you use any site profile oder module? Link to comment Share on other sites More sharing options...
arjen Posted December 21, 2012 Share Posted December 21, 2012 Could this thread be of any help? 1 Link to comment Share on other sites More sharing options...
Harmster Posted December 21, 2012 Share Posted December 21, 2012 You can try to use JQuery? Though its not really a pw answer removeAttr Link to comment Share on other sites More sharing options...
diogo Posted December 21, 2012 Share Posted December 21, 2012 By default Processwire doesn´t generate any markup. Could you please provide us more information about your site setup? Do you use any site profile oder module? @Luis, must be on tinyMce. @Jens, this is how tinyMCE treats images and there are more people requesting the ability to od what you want. You can read about it here http://www.tinymce.com/develop/bugtracker_view.php?id=4770. Make sure to use images on tinyMCE only when you need them. I suspect that for this case it would be more suitable to output the images directly from the image fields. If you still want to have them in the middle of the text, you can use my Image Tags module as it doesn't assume any size for the images http://modules.processwire.com/modules/textformatter-image-tags/. Link to comment Share on other sites More sharing options...
Luis Posted December 21, 2012 Share Posted December 21, 2012 @Luis, must be on tinyMce. yes right, never thaugt about images via tinyMCE Link to comment Share on other sites More sharing options...
alan Posted December 21, 2012 Share Posted December 21, 2012 (edited) Not tried it yet, but this may be of interest http://adaptive-images.com/ as it is to do with images in responsive design even though it is not strictly to do with responsive images. Edited December 21, 2012 by alanfluff Link to comment Share on other sites More sharing options...
adamspruijt Posted December 21, 2012 Share Posted December 21, 2012 As I posted in the thread Arjen link to, the height and width being output is a non-issue. Am I missing something here? I've never had a problem with this working img { max-width: 100%; height: auto; } No need to remove attributes, this is (from what I've read) the best way to handle this. Height will go back to being relative to the image proportions and the width will max out at 1oo% of its parent. Since the "width" attribute is equivalent to the "width" css property we know then that the "max-width" property has the power to override this. Link to comment Share on other sites More sharing options...
Soma Posted December 21, 2012 Share Posted December 21, 2012 Not tried it yet, but this may be of interest http://adaptive-images.com/ This is just to serve different image sizes depending on viewport size, I've used it here http://www.the-omnia.com and it works well but has nothing to do with responsive images. Link to comment Share on other sites More sharing options...
alan Posted December 21, 2012 Share Posted December 21, 2012 it works well but has nothing to do with responsive images. Thanks Soma, edited Link to comment Share on other sites More sharing options...
onjegolders Posted January 3, 2013 Share Posted January 3, 2013 On Arjen's thread, Apeisa's solution works for me with the caveat he mentions. Link to comment Share on other sites More sharing options...
netcarver Posted January 3, 2013 Share Posted January 3, 2013 The v2.5.1 version of textile just gained better support for responsive layouts by optionally omitting dimensions from images. I'll have to work out how to make the TextileTextformatter modules configurable before I can add a control into the module for this feature. I'm beginning to think that I might just make omitting the dimensions the default in PW for now. Link to comment Share on other sites More sharing options...
adamspruijt Posted January 3, 2013 Share Posted January 3, 2013 Not to get too pushy with this one but as I've already mentioned, you are solving a problem that never existed. The best approach from a semantic/usability standpoint is to include this in you CSS: img { max-width: 100%; height: auto; } max-width: 100% will ensure that an image cannot be larger than it's parent and height: auto will override the height attribute on the image allowing its height to be based on the original aspect ratio. Link to comment Share on other sites More sharing options...
apeisa Posted January 3, 2013 Share Posted January 3, 2013 Not to get too pushy with this one but as I've already mentioned, you are solving a problem that never existed. I edited my post in linked topic trying to make this fact more clear and avoid further confusion Link to comment Share on other sites More sharing options...
adamspruijt Posted January 3, 2013 Share Posted January 3, 2013 I edited my post in linked topic trying to make this fact more clear and avoid further confusion Thanks Apeisa! It's not as though from anything I've read there is a problem with removing the attributes I just feel that it's a lot nicer to use a simple piece of css and avoid the troubles all together. Link to comment Share on other sites More sharing options...
onjegolders Posted January 4, 2013 Share Posted January 4, 2013 I've always used max-width: 100% before but pretty sure I ran into a problem anyway though I can't remember why... Link to comment Share on other sites More sharing options...
apeisa Posted January 4, 2013 Share Posted January 4, 2013 Height auto is the magic. 1 Link to comment Share on other sites More sharing options...
onjegolders Posted January 4, 2013 Share Posted January 4, 2013 Height auto is the magic. Sorry, yes I mean I always used both max-width and height auto since building responsive sites, don't know what the issue I had was but I could've sworn there was one! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now