Pictures not showing in placeholder

Showing 1-8 of 8 messages
Pictures not showing in placeholder giumast 2/16/12 2:35 AM
Good day, django-cms developers :-)
I've got a question for you: why does the pictures plugin not work?
Speaking in detail: i've got a template, inside my template i've got a
"page content" placeholder. When i try to insert stuff into this
plugin (i.e. google maps plugin, text), everything works fine.
Instead, when i try to insert an image, i upload the file, i save the
placeholder, everything works fine on admin side, but... when i look
at the page, nothing happens! Not a single html line is created by the
picture plugin. Does anybody know why is this happening?
Re: Pictures not showing in placeholder Bart van der Hoeven 4/13/12 2:51 AM
I have got the exact same problem.
Did you already find a solution?

On Feb 16, 12:35 pm, Giuseppe Mastrandrea
Re: Pictures not showing in placeholder Tomas Neme 4/13/12 6:30 AM
You need to set up your urls to serve the media files on debug.

Try adding this to your urls:

if settings.DEBUG:
    urlpatterns += patterns('',
        url(r'^%s/(?P<path>.*)$'%settings.MEDIA_URL.strip('/'),
            'django.views.static.serve', {
                'document_root': settings.MEDIA_ROOT,
                }),
                            )


--
You received this message because you are subscribed to the Google Groups "django-cms" group.
To post to this group, send email to djang...@googlegroups.com.
To unsubscribe from this group, send email to django-cms+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-cms?hl=en.




--
"The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny 
(")_(") to help him gain world domination.
Re: Pictures not showing in placeholder Richard Barran 9/4/12 4:42 PM
Hi Korey,
I presume that you are using the default picture plugin?
Have you created a picture.html template as per documentation?
HTH

-- Richard

On Monday, September 3, 2012 5:28:03 AM UTC+1, Korey Peters wrote:
Hi Tomas,

Sorry to resurrect this post but I'm having the same issue, but I already have the text you suggested in my URLs.

When I inspect the HTML of my page, there is no HTML related to the picture. I have the same problem on both my local machine (with DEBUG=True) and on my production server (with DEBUG=False). Any recommendations would be greatly appreciated.

Kind regards,
Korey

Re: Pictures not showing in placeholder Korey Peters 9/4/12 9:28 PM
Hi Richard,

Yes, I can confirm the template exists and is being rendered. Inserted text between the
{% load thumbnail %}

and 

{% if picture.url %}<a href="{{ picture.url }}">{% endif %}
lines, and it rendered properly.

I appreciate your help.

Kind regards,
Korey
--
You received this message because you are subscribed to the Google Groups "django-cms" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-cms/-/Tcs41bjZ9ycJ.

To post to this group, send email to djang...@googlegroups.com.
To unsubscribe from this group, send email to django-cms+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-cms?hl=en.

Re: Pictures not showing in placeholder Tomas Neme 9/4/12 9:54 PM
> Hi Richard,
>
> Yes, I can confirm the template exists and is being rendered. Inserted
> text between the
>
> {% load thumbnail %}
>
> and
>
> {% if picture.url %}<a href="{{ picture.url }}">{% endif %}
>
> lines, and it rendered properly.
>
> I appreciate your help.

then you probably need to read that template again, and make sure you
understand what you're reading and what's going on.

In that template, the <img> tag rendering is inside an {% ifequal
placeholder <something> %} tag. Are you SURE that's the behavior you
want? I'm guessing not. I'm guessing your placeholder is named neither
"content" nor "teaser", and you just copy-pasted that template.

If I'm wrong, sorry, but do go on and put some debugging text inside
all blocks of that template to try and figure out what's going on. I
usually do this with html comments, and also render some of the
template variables that seem to be failing.

For example, I may insert something like this.

<!-- ifequal "content" block. picture-url: "{{ picture.url }}",
thumbnail-output: "{% thumbnail picture.image 300x600 %}" -->
Re: Pictures not showing in placeholder Korey Peters 9/30/12 2:04 PM


In that template, the <img> tag rendering is inside an {% ifequal
placeholder <something> %} tag. Are you SURE that's the behavior you
want? I'm guessing not. I'm guessing your placeholder is named neither
"content" nor "teaser", and you just copy-pasted that template.

Hi Tomas,

Yes, I definitely did copy and paste the template. :) With some exploration I discovered what my "placeholder" was called. I can now get the link to render, but the picture isn't showing because the src element inside the "img" tag is pointing to the absolute path on my server, not the url that would load the picture.

So, I'm getting src="/home/me/some/directories/media_root/client/cms_page_media/picture.jpg" instead of src="http://my.domain.com/media_url/cms_page_media_path/picture.jpg".

CMS_MEDIA_ROOT = '/cms/media/root'  <- This currently seems to do nothing
CMS_MEDIA_PATH = '/cms/media/path'  <- This currently seems to do nothing
CMS_PAGE_MEDIA_PATH = MEDIA_ROOT + 'client/cms_page_media/'  <- Works. Pictures show up there
CMS_MEDIA_URL = MEDIA_URL + 'client/cms_page_media/' <- Doesn't show up, but I think it should.

Changing CMS_PAGE_MEDIA_PATH changes where the incorrect "src" element in points to in the generated HTML, but changing the other values seems to have no effect.

Sorry for being so thick. Any help is appreciated.

Kind regards,
Korey
Re: Pictures not showing in placeholder Tomas Neme 9/30/12 3:09 PM
read this again:

http://django-cms.readthedocs.org/en/develop/getting_started/configuration.html#std:setting-CMS_MEDIA_PATH

so you need to set up MEDIA_ROOT (which should be the absolute path to
your local directory where the files are being served,
/home/me/some/directories/media_root/) and CMS_MEDIA_PATH (if you
want, otherwise, it'll just be cms/). CMS_MEDIA_ROOT will
automatically be set up to MEDIA_ROOT + CMS_MEDIA_PATH, so don't worry
about it.

now you ALSO need to set up MEDIA_URL which should be the absolute URL
where you're serving your media files, i.e.: the internet path to your
MEDIA_ROOT directory, usually /media/.

so... basically, just make sure MEDIA_URL is set to /media/ and then
{{ picture.url }} should show you something among the lines of
"/media/cms/path/to/filename.jpg"