Re: displaying correct image url

2008-12-27 Thread garagefan

the ability to edit posts would be nice :)

i figured out the issue and am now displaying relative urls to the
images.

now, to edit the delete function to remove the thumbnails as well...

On Dec 27, 1:21 pm, garagefan  wrote:
> currently, self.image.name displays the absolute server path...
>
> i want to change this so that when i call it, it either display the
> relative path, or an absolute path for the website itself.
>
> so instead of displaying /home/site/mysite/images/gallery/
> imagename.jpg
>
> it will displayhttp://www.sitename/images/gallery/imagename.jpg
>
> in settings i have:
>
> MEDIA_ROOT = '/home/site/mysite/images'
> MEDIA_URL = 'http://www.sitename.com/images/'
>
> in the models.py:
>
> image = models.ImageField(upload_to='/home/site/mysite/images/
> gallery')
>
> "mysite" being the base level directory for the site itself
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



displaying correct image url

2008-12-27 Thread garagefan

currently, self.image.name displays the absolute server path...

i want to change this so that when i call it, it either display the
relative path, or an absolute path for the website itself.

so instead of displaying /home/site/mysite/images/gallery/
imagename.jpg

it will display http://www.sitename/images/gallery/imagename.jpg

in settings i have:

MEDIA_ROOT = '/home/site/mysite/images'
MEDIA_URL = 'http://www.sitename.com/images/'

in the models.py:

image = models.ImageField(upload_to='/home/site/mysite/images/
gallery')

"mysite" being the base level directory for the site itself


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