monotouch: Image not displaying in email - html

I have some html that has an image in a table. The table displays fine in a UIWebView. I take that same html and send it in an email (using MFMailComposeViewController). The code snippet to build the html is:
html += "<tr><td><img src=\"reading.png\" align=left></td><td>"
The table is created properly, but the image just has a question mark in a blue box. (Obviously, it can't find the image, but why?)
How do I fix this?

The path "reading.png" is not found, that is the reason why you do not see the image.
There are in fact several potential solutions.
1) put the image to the web URL something like http://yourweb address.com/reading.png, this works well and will show, all the clients supports this and user just need to click to "show images" if he/she has it disabled by default in the email client.
2) second solution is to put the specific image representation to the img tag, you can do so by opening the file, reading its content and adding it as base64 data to the src of the img, there are plenty of samples for this.
3) third is to add it as attachment to the email. Again plenty of samples here and on the web how to do that.
Conversion of the sample code from ObjectiveC is simple to Monotouch.
Hope this helps.

Related

Html - Images won't show up (relative link)

I worked on a Website locally and it works well. When i put it online, images won't show up.
My html file is in "folder" & images are situated in "folder/images".
When I made my website, I used this link to put images on my html code:
<img src="images/firstimage.png">
I understand the issue here is the path I used. I would like to know if there is a way to manage this without rewriting all links 1 per 1 on my html code ?
Sorry if for this noobish question this is my firsts hours of coding. Any documentation related would be appreciated.
Greetings
Use Ctrl+R (not in every html-editor, I often use that in IntelliJ) to replace the marked text with the newly entered text. So you can write "images/" (it will marked ALL text where it occurs) to overwrite ALL marked text with following: "folder/images/"
For more information look at this question

Web preview when posting on Facebook/Linkldin

I got a little issue,
when I share my portfolio in Facebook or Linkdin I get a preview of the web as an image but with a wrong image(one of the images included in the code itself).
how can I fix that so that the preview image will be the the web image?
thanks
If you've already generated the image, I think you need to use this: developers.facebook.com/tools/debug to rescrap it and try and get FB to pull in the correct image.
There's a section, in the screenshot, that allows you to bulk clear FB caches if it's more than one URL you're having issues with, if it's just the one, the first tab should be what you need.

Is any image link suitable for suitable for adding in html file?

I know I can add images to a html file by the following syntax
<img src="*****">
But my question is can i copy any images link from the web and add them to my html file?
i'm not talking about the copyright laws regarding this, just, can every image link be used as the image source in html?
I was writing a code in codepen where i embedded a link to an image from devianart, but the image didn't show up.
I think it depends to the website policy; Some websites don't let you to use their hosted images in your webpage, and some others do.
this is what i find on W3schools:
Definition and Usage:
The required src attribute specifies the URL of the image.
Note: When a web page loads; it is the browser, at that moment, that gets the image from a web server and inserts it into the page. Therefore, make sure that the image actually stay in the same spot in relation to the web page, otherwise your visitors will get a broken link icon. The broken link icon is shown if the browser cannot find the image.
The URL of the image.
Possible values:
An absolute URL - points to another web site (like
src="http://www.example.com/image.gif")
A relative URL - points to a file within a web site (like
src="image.gif")
Hope this is helpful :)
make sure image fully open in your browser tab/
i also check it but it work in codepen may be you doing something wrong first need to write clear what you want
try this image tag in codepen

Identical HTML not rendering the same

I have a program that let's people design web pages graphically. Then hitting Publish creates an html file that is supposed to be an exact copy of what they created. The elements created by the editor are HTML elements. Publish then gathers up all the elements that have been created and for each one adds it to a string with
canvasOuterHTML += clone$[0].outerHTML;
So all the styles, text, etc., get put on the string. This string, along with some other information is written to the .html version of the page, and when this .html is loaded into a browser the browser displays the page!
But something is expanding the published page vertically. I've created the simple page below to illustrate. The first image is the page in the editor. The second image is what the html displays in the browser.
I'm completely stumped because the HTML and CSS for the two markups is exactly the same, so how can one be higher? I can't even think of a mechanism that would do that. Does anyone have any ideas? Thanks.

HTML Attachments opened in Apple device not showing some images

I am wondering if someone can help me with a problem I am encountering with iPhone/iPad. I have an email the generates a report as an HTML attachment. In that HTML attachment, there are two images. One is a static image that pulls down a logo using a normal HTML img tag.
The other is dynamic. It also uses the normal HTML img tag, however it calls out to a web api with some information identifying the user.
<img src="http://MyApiServerName.com/api/User/{id}/{OtherParm}" >
The Web API uses information on the user to return appropriate images to them. For some reason the dynamic image does not show up with the attachment is opened on an iPad/iPhone.
The image works just fine when the attachment is opened from a computer. I thought maybe something might be blocking images, however then I would expect the static image not to display as well. I verified that the "Load Remote Images" setting is turned on.
I am at a loss here. Is there something with iOS that prevents dynamically generated images from showing in HTML attachments?
Thanks
Ok, I can't explain why the above is not working, but I did find something that does. Instead of using the following URL
<img src="http://MyApiServerName.com/api/User/{id}/{OtherParm}" >
use
<img src="http://MyApiServerName.com/api/User/{id}/{OtherParm.jpg}/" >
The final param needs to end with ".jpg/". If the slash is not there, you will get a 404 error.
Then in the API method, you simply strip off the .jpg part of "OtherParm" to get the intended value for "OtherParm".