In my templavoila I have an image field. It's mapped to be put inside a div tag.
Then I add an image to my page:
But when the page is rendered I get this HTML:
<img width="" height="" border="0" alt="" src="">
Any ideas why the src attribute does not get filled?
As there is no thumbnail generated as well your image magick settings are probably wrong.
Do the test images get generated correctly there? If not, maybe an update of your binary solves it.
maybe the mapping is wrong. you can try this:
Related
I have a little question about the image tag of wagtail.
Is it possible to apply the image tag twice time on the same image in a concatenated manner?
For example:
{% image photo width-1500 as photo_scaled %}
{% image photo_scaled fill-400x300 as image %}
Thanks in advance
When you use the template tag image (eg. {% image photo width-1500 as photo_scaled %}), you are generating an image rendition, not a new image. So you cannot then generate a new rendition from a rendition.
A “Rendition” contains the information specific to the way you’ve requested to format the image using the resize-rule, i.e. dimensions and source URL. Image Tag Docs
However, in your question above, fill-400x300 will produce the exact same rendition size/compression - irrelevant to the input image.
I've been try to add the background image of a div to a value from Sitecore (8.0) in C# MVC using the code
<div style="background-image: url({Model.MyImage.Src})>
Where MyImage is of type Image as returned by GlassView
This is returning html such as
<div style="background-image: url(/~/media/myFolders/myImage.ashx)">
This image isnt being displayed when the page is rendered- although the url resolves when entered into the browser's address bar so it must be an issue with the .ashx extension as a background image for a div.
I also tried using Sitecore.Resources.Media.MediaManager.GetMediaUrl(mediaItem) but this also returned me the ashx which couldn't be resolved!
Try background-image: url('#Model.Image.Src'). While your example doesn't show it, you most likely have spaces in your folder or file name, which requires single or double quotes.
Add single quotes around it.
url('{Model.MyImage.Src}')
Should make this
url('/~/media/myFolders/myImage.ashx')
for my case sitecore 8.2 stop working below code because of style attribute
I have replaced style attribute with img tag and start working
<span><img src="#item.GetImageUrl("MyImage")" alt="" class="icon" /></span>
Hi I'm having a problem about referring to uploaded images in HTML.
I'm using ImageField to save profile pictures :
picture = models.ImageField(upload_to='stories/static/stories/profile_images/', blank=True)
As you can see, It'll upload to <App folder>/static/stories/profile_images/
Then I refer it in HTML like this :
<div class="profilepic" style="background-image: url('/{{ x.writer.picture }}');"></div>
Which directs to
ROOT/stories/static/stories/profile_images/.jpg
Instead of
ROOT/static/stories/profile_images/.jpg
Any ideas?
(I'm trying to reverse-truncate the first 8 character, but there is not built-in template filter available)
since your upload_to is stories/static/stories/profile_images/, it IS showing right path:
ROOT/stories/static/stories/profile_images/.jpg
and one more thing, you need .url to get the picture with its path
{{ x.writer.picture.url }}
I am programming a website powered by Django 1.6.3. Under news you always see a big story and on the side recent articles. Therefore, I used Bootstrap 3 and wrote a static html page serving my requirements.
Now I would like to program the logic behind this. I save all my files under static that consists of the folders css, fonts (from Bootstrap), img and js. The image folder has some subfolder e.g. news. To create a new entry on the news page I would like to open the admin page, add a news_entry and select one image that should be under the titel. How is it possible to include the image in the page? My approach was:
<img src="{% static {{ news.image_name }} %}" class="img-title">
Unfortunately I get an parsing error. Image_name is a property of my news model.
You need to access the url attribute of your image_name.
Try:
<img src="{{ news.image_name.url }}" class="img-title">
Similar question here.
Is there a particular syntax for freemarker template to be used to display image?
I have used the usual
<img src = "test1.png" />
in the body tag of the ftl template to display image but it is not displaying the image for me when I run the code. FTL generates the html page with all relevant data excpet that it doesnt display image.
SHould I use any escape sequences or any other syntax?
Thnks
Got the answer..
Its
<img src= "test1.jpg" />
just like I had added before. I wonder why it wasnt working earlier.