Skip to content

Instantly share code, notes, and snippets.

@lincolnpixel
Forked from paul-frost/gist:2ea5c8ce57aec116ed75
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save lincolnpixel/1d42e2f3c1cf9a94a908 to your computer and use it in GitHub Desktop.

Select an option

Save lincolnpixel/1d42e2f3c1cf9a94a908 to your computer and use it in GitHub Desktop.
This method requires the CE Image addon.
Tell your editors to change the width/height/alignment in the image properties pop up to 300px or whatever and set the alignment if they want, but the actual size displayed on the page will be decided by you in the template code and CSS.
In the EE template:
{exp:ce_img:bulk max="500" crop="no" allow_scale_larger="no" quality="80" output='<a href="{orig}" class="embeded_image" title="{attr:title}" alt="{attr:alt}" style="{attr:style}"><img src="{made}" /></a>'}
{wygwam_field}
{/exp:ce_img:bulk}
In the CSS:
.embeded_image {
float: none;
margin-left: 0; }
@media only screen and (min-width: 550px) {
.embeded_image {
max-width: 50%;
margin: 0 2%; }
}
Or, if you want to have a captioned included, get the editors to fill in the Altenrnative Text box with a caption (probably easier than getting them to use the Advanced tab and completing the Advisory Title) and then wrap it all in a Div. Note that you need to move the Style attribute into the Div if you want the editors to be able to control the left/right alignment:
{exp:ce_img:bulk max="500" crop="no" allow_scale_larger="no" quality="80" output='<div class="embeded_image" style="{attr:style}"><a href="{orig}" title="{attr:title}" alt="{attr:alt}"><img src="{made}" /></a><p class="caption">Caption: {attr:alt}</p></div>'}
and add this (or whatever stye you want) to your CSS:
.caption {
text-align: center;
font-weight: bold;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment