Re: image in browser
On Thu, Jun 14, 2012 at 3:33 PM, kenneth gonsalveswrote: > from the questions you have been asking on the list it seems to me that > you are unfamiliar with web programming. I suggest that you take some > time out to learn the basics of web programming and also to understand > how django works. I suggest you do the tutorial in the official > documentation. Also you should learn at least the basics of javascript. > The problem you have been bringing up in the last week is not best > solved by generating an image on the server side and passing it to the > template. The problem is solved by generating the data server side, > passing this data to the template and using a js library to generate and > render the image on the page. > thnx Sir. I will do that. -- Satvir Kaur satveerkaur.blogspot.in -- 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.
Re: image in browser
> You better show us the template too. Problem solved. Image is displaying just putting the image into the localhost directories(/var/www/logo.png) and giving the src attribute as http://localhost/logo.png; `width="200" height="200" alt="image is not available" align="right"/> -- Satvir Kaur satveerkaur.blogspot.in -- 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.
Re: image in browser
На Thu, 14 Jun 2012 14:21:00 +0530 Satvir Toorнаписа: > > This is a strange thing to want to do. What are you doing with > > `img` in the template? > I am using image_data variable as a image source in the template(html > file). > > > What should i ??? Image is not displaying. Use static files for that: https://docs.djangoproject.com/en/dev/howto/static-files/ -- 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.
Re: image in browser
Why would you do that this way? The usual way would be to put your images into the static files and serve it from there. However, you should be able to do it that way using base64 encoding of the binary data: from base64 import b64encode def my_image(request): image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read() return render_to_response('myapp/bio.html', {'img': b64encode(image_data)}, context_instance=RequestContext(request)) After that, you can output your image inside the template by using On 06/14/2012 08:15 AM, Satvir Toor wrote: hello, i wish to display the image into the browser through a template . I used the following code to retrieve the image from Disk and send that data to Html file def my_image(request): image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read() return render_to_response('myapp/bio.html', {'img':image_data}, context_instance=RequestContext(request)) Now, The image is not availble into the html file that is displaying in browser, Tell me where I m wrong. -- 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.
Re: image in browser
На Thu, 14 Jun 2012 11:45:19 +0530 Satvir Toor <toor.satvi...@gmail.com> написа: > hello, > > i wish to display the image into the browser through a template . I > used the following code to retrieve the image from Disk and send that > data to Html file > > def my_image(request): > image_data = open("/home/toor/Desktop/certificate/logo.png", > "rb").read() return render_to_response('myapp/bio.html', > {'img':image_data}, context_instance=RequestContext(request)) > Why don't you use static files? > Now, The image is not availble into the html file that is displaying > in browser, Tell me where I m wrong. You better show us the template too. -- 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.
Re: image in browser
On Thu, 2012-06-14 at 14:21 +0530, Satvir Toor wrote: > > This is a strange thing to want to do. What are you doing with `img` > in the > > template? > I am using image_data variable as a image source in the template(html > file). > > > What should i ??? Image is not displaying. > > from the questions you have been asking on the list it seems to me that you are unfamiliar with web programming. I suggest that you take some time out to learn the basics of web programming and also to understand how django works. I suggest you do the tutorial in the official documentation. Also you should learn at least the basics of javascript. The problem you have been bringing up in the last week is not best solved by generating an image on the server side and passing it to the template. The problem is solved by generating the data server side, passing this data to the template and using a js library to generate and render the image on the page. -- regards Kenneth Gonsalves -- 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.
Re: image in browser
On Thu, Jun 14, 2012 at 2:32 PM, Daniel Rosemanwrote: > On Thursday, 14 June 2012 09:51:00 UTC+1, Satvir Kaur wrote: >> >> > This is a strange thing to want to do. What are you doing with `img` in >> > the >> > template? >> I am using image_data variable as a image source in the template(html >> file). >> >> >> What should i ??? Image is not displaying. > > > Normally in an HTML file you put the image path in the src attribute, not > the binary data (you can use a data URI with base64 encoding, but you almost > certainly don't want to do that). Yes Sir, when i put whole path of image in src attribute its not working. -- Satvir Kaur satveerkaur.blogspot.in -- 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.
Re: image in browser
Why don't you use staticfiles? https://docs.djangoproject.com/en/dev/howto/static-files/ On 06/14/2012 08:15 AM, Satvir Toor wrote: hello, i wish to display the image into the browser through a template . I used the following code to retrieve the image from Disk and send that data to Html file def my_image(request): image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read() return render_to_response('myapp/bio.html', {'img':image_data}, context_instance=RequestContext(request)) Now, The image is not availble into the html file that is displaying in browser, Tell me where I m wrong. -- 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.
Re: image in browser
On Thursday, 14 June 2012 09:51:00 UTC+1, Satvir Kaur wrote: > > > This is a strange thing to want to do. What are you doing with `img` in > the > > template? > I am using image_data variable as a image source in the template(html > file). > > > What should i ??? Image is not displaying. > Normally in an HTML file you put the image path in the src attribute, not the binary data (you can use a data URI with base64 encoding, but you almost certainly don't want to do that). -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/bPOH5SGCtHEJ. 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.
Re: image in browser
> This is a strange thing to want to do. What are you doing with `img` in the > template? I am using image_data variable as a image source in the template(html file). What should i ??? Image is not displaying. -- Satvir Kaur satveerkaur.blogspot.in -- 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.
Re: image in browser
On Thursday, 14 June 2012 07:15:19 UTC+1, Satvir Kaur wrote: > > hello, > > i wish to display the image into the browser through a template . I > used the following code to retrieve the image from Disk and send that > data to Html file > > def my_image(request): > image_data = open("/home/toor/Desktop/certificate/logo.png", > "rb").read() > return render_to_response('myapp/bio.html', {'img':image_data}, > context_instance=RequestContext(request)) > > > Now, The image is not availble into the html file that is displaying > in browser, Tell me where I m wrong. > > > -- > Satvir Kaur > This is a strange thing to want to do. What are you doing with `img` in the template? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/U6RaTow-dJQJ. 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.
image in browser
hello, i wish to display the image into the browser through a template . I used the following code to retrieve the image from Disk and send that data to Html file def my_image(request): image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read() return render_to_response('myapp/bio.html', {'img':image_data}, context_instance=RequestContext(request)) Now, The image is not availble into the html file that is displaying in browser, Tell me where I m wrong. -- Satvir Kaur -- 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.