Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Auto resizing an image used in a question

  • khawkes
  • khawkes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #138007 by khawkes
Hi,

We're trying to automatically resize an image used in a question so the whole image can be seen regardless of browser window size/device being used.

If I use the "source" button to edit the html ("Edit question" screen), I only seem to be able to set the width/height explicitly (eg <img src="blah.jpg" style="width:700px;height=100px;" />). If I try switching to say, "width:100%", LimeSurvey just seems to delete the style details when I save and ignores the request.

I am hoping there is a way I can just do the auto-resize in the question itself as we have a university wide licence for LimeSurvey and we are not allowed (and don't have access) to edit the .css templates as it affects everyone, not just out group.

Please help if you know a way around this!
The topic has been locked.
More
7 years 8 months ago #138017 by steve_81
Replied by steve_81 on topic Auto resizing an image used in a question
Hi,

which version do you use? In 2.06 and 2.50 (default templates) it works with your described procedure (edit the source).

Maybe hard html works:
Code:
<img src="blah.jpg" width="100%">

Greets
Steve
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #138021 by DenisChenu
Replied by DenisChenu on topic Auto resizing an image used in a question
Hi,

In general i prefer to use
<img src="blah.jpg" alt="">

No width forced. Css do img{max-width:100%;height:auto}

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #138024 by tpartner
Replied by tpartner on topic Auto resizing an image used in a question
What version of LimeSurvey are you using? The editor should not modify the inline styles like:

Code:
<img src="blah.jpg" style="width:700px; max-width:100%; height: auto;" />

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • khawkes
  • khawkes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #138226 by khawkes
Replied by khawkes on topic Auto resizing an image used in a question
Thanks to all, but you've all just confirmed what I thought - the source shouldn't be modified when I save, but it is. :(
If I put in the code exactly as tpartner suggests above, it just wipes the "max-width" bit and ignores that I've ever tried to put it in (and the image doesn't resize).
I've attached the pre- and post- save screenshots (LimeSurvey version 2.06).
Is it possible there's something in the css that is overriding??
I'm feeling like I have to think of another work around as the survey isn't going to work on mobile devices if I can't get the image to resize properly!!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #138228 by DenisChenu
Replied by DenisChenu on topic Auto resizing an image used in a question
Maybe due to buildnumber : update to last 2.06 version

BUT : you can deactivate HTML editor : manual.limesurvey.org/First_login_-_Your_user_preferences#Popup

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose