Add an image to Django admin header - django-templates

How do I display an image in the header of Django's admin (I refer to the place on the top of the page with the yellow title "Django administration" with blue background)?
I've tried to so with the HTML tag of <img> with some absolute path (under the assumption that the server and the client are running on the same machine):
<img width="225" height="151" src="C:\Python27\Lib\site-packages\django\contrib\admin\media\img\admin\sunrise.png" alt="Sunrise here">
But the image isn't displayed (just the string "Sunrise here").

Related

how I can get full URL of images when using getPageHTML of dokuwiki xmlrpc api

I want to embed the HTML content of a dokuWiki page inside another web application. The content should be shown as a tooltip popup. But when I use the 'wiki.getPageHTML' api method to get the content, embedded images dont have the full path in their tag.
Like: <img src="/mywiki/lib/exe/fetch.....">
Is it possible to get the full image path in HTML code?
E.g.: <img src="https://testwiki.com/mywiki/lib/exe/fetch....">
This option do the job: https://www.dokuwiki.org/config:canonical
thx for andi who answered my question here.

Fit PDF page in container using ngf-thumbnail

I have the following line of code to embed pdf in HTML
<embed ngf-thumbnail="factura.picFile" id="factura_prev_pdf" ng-show="factura.preimageext=='pdf'" class="view_complete_image" type='application/pdf'>
As you can see I'm using ngf-thumbnail to show the pdf.
Javascript attached to the id just get the extension, not important here.
ng-show say true if extension id pdf and the css class adapt the pdf to the container size.
The thing is that the pdf preview is adapted to the width and height but the page is not visualized entirely.
Any idea ?
I saw things like Zoom to fit: PDF Embedded in HTML
But it doesn't work to me since I'm not using
EDIT what I see now is that you can modify a pdf url like http.thingthing.pdf#view=fit to make page fit but my files are loaded from local so it creates a blob:url where I cannot put this view=fit.
It's possible to convert this blob url to a normal url with the pdf extension?
Finally I achieved the following:
<img ngf-thumbnail="factura.picFile" id="factura_prev_image" class="view_complete_image">
<embed ngf-thumbnail="factura.picFile" id="factura_prev_pdf" ng-show="factura.preimageext=='pdf'" class="view_complete_image" type='application/pdf'>
<img src="{{ factura.image.url }}" ng-show="factura.preimage && factura.preimageext=='jpg'" id="factura_image" class="view_complete_image">
<embed src="{{ factura.image.url }}#view=fit" ng-show="factura.preimage && factura.preimageext=='pdf'" class="view_complete_image" type='application/pdf'>
As you can see, in the first 2 lines I'm using ngf-thumbnail... This two fields contains local files so to visualize it we get a Blob Url, in this way I couldn't add the #view=fit that allows me to visualize the entire pdf page.
In the last 2 lines we get pdf's that are uploaded to a server so we get a normal url.
In this way I can add the #view=fit so the page fits.
Hope it helps to someone.
This answer is to know how to fit a pdf page, but I'm not answering to fit the page when we get a Blob Url.

Google shows alt-text as website title

I am trying to optimize a web site which is managed by typo3. There is a page on this website, let's call it seminars. When I ask google to search for this Website by entering "Big Company seminars", I receive a result which looks like that:
Logo Seminars - Big company
url://seminars.bigcompany.de
The string "Logo" should not be displayed there. So I checked the source code and found that:
<title>Seminars - Big Company</title>
and
<img src="BigCompanyLogo.png" alt="Logo Seminars">
It looks like Google takes the alternative text of this image and uses it as the title for their search results.
Any ideas?
Google Search may change webpage titles they show on their result page. You can’t control this.
About your alt content:
Is the page about "Logo Seminars", or does "Logo" mean that the image is the logo? In the latter case, you might want to remove "Logo" from the alt content (or place it, for example, in square brackets). Note that, if the image is the only content of the link, the alt content should describe the link target, not the image.

Google+ Sharer - preview image

I am using links like this : https://plus.google.com/share?url=www.myurl.com to share articles on Google+ from a website.
This works fine but the preview image of the share is not right.
I read in the Google doc that you need to specify an image like this:
<img itemprop="image" src="thumbnail.jpg" />
The thing is, the image I want to use is not being displayed on the page I want to share. I have specific thumbnail images (of smaller size than the images displayed in the article) that I'd like to use.
Is there a way to specify an image for Google, like the og:image tag for Facebook for example, without having to use the tag?
Is there a way to specify an image for Google, like the og:image tag for Facebook for example, without having to use the tag?
https://developers.google.com/+/plugins/snippet/:
2. Open Graph protocol
If the page contains Open Graph properties for the title, image, and description, they will be used for the +Snippet.
Additionally, the schema.org tag that defines your page's preview image does not need to be displayed on the page, you could instead define it within your HEAD as metadata:
<meta itemprop="image" content="thumbnail.jpg" />

Hotlinking: How do I differentiate between an image in a <img> tag versus an image link?

I want to allow partial hotlinking to images on my website. I want to allow a specific site (Reddit) to be able to show an image from my website on their page, but if they click on the link to the image from that site, it should go to an image viewing page, rather than directly the image itself.
For example:
This other website should be able to have this
<img src="http://mySite.com/myImage.jpg"/>
on their page, and it should show the image. However, if they have this:
Link Text
A user who clicks on that link should get redirected to an image viewing page that contains some html, including the image, rather than directly to the image.
I'm trying to achieve this via mod_rewrite. However, those two cases have the same HTTP_REFERER. Is there anyway for my server to differentiate between that?
There is no way to do such thing! but if second site is your you can put optional query string at the end of URL the distinguish between them!