Scraping source view image link with SwiftSoup - swift

I'm trying to grab faveIcon image from a website using SwiftSoup
if rel == "icon", try element.attr("type") == "image/x-icon", element.hasAttr("href") {
favIconUrl = try element.absUrl("href")
}
The issue is, in href, there is no any direct url, and it looks like an hyperlink (not so expert on HTML), it's href="/favicon.ico" , which favicon.ico is clickable and it will open the url. My question is, how I can access to the link inside the favicon.ico? Your help would be appreciated.
Many thanks

Related

How do I set an image for Facebook to use in links to Mediawiki pages

Links from Facebook to my Mediawiki-powered website show an ugly default image for links. (The squarish image which shows a truncated "Powered by Mediawiki") pointed to by the gray arrow.)
How do I override this? I'm looking for a single image which would be the same for all pages rather than a custom image for each page. I want to avoid adding extensions if possible!
Added: #wgLogo is set and the logo file thus set does appear on the individual pages, but not on the FB link.
It seems that the secret is to set <meta property='og:image'… on every page (https://developers.facebook.com/docs/sharing/webmasters/images/).
To do so without installing extensions, add to your LocalSettings.php:
$wgHooks ['BeforePageDisplay'] [] = function (OutputPage &$out, Skin &$skin): bool {
$out->addMeta ('og:image', '(path to your image)');
return true;
};
Further reading:
https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
https://doc.wikimedia.org/mediawiki-core/master/php/classOutputPage.html#a1d667167a39be62f9988e94256508489
The PageImages extension adds the most prominent image used on the page as the OpenGraph image. The WikiSEO extension lets you set it manually (per-page or sitewide).

dynamically change facebook og image in a fancybox share button

The goal :
I would like to have a share button in my fancybox that share the image I'm looking at with the correct image name in the Facebook sharer. I would like that when a user click on this in Facebook, he arrives on an opened Fancybox with the correct image.
The problem :
I have a gallery with Jquery FancyBox (http://fancyapps.com/fancybox/). I added a share button with the code I find in this fiddle (http://jsfiddle.net/G5TC3/).
My share button works, but get the meta og from the site and I want to have the og:image from the image I'm looking at.
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
beforeShow: function () {
if (this.title) {
// Add FaceBook like button
this.title += '<iframe src="//www.facebook.com/plugins/like.php?href=' + this.href + '&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:23px;" allowTransparency="true"></iframe>';
}
},
helpers : {
title : {
type: 'inside'
}
}
});
For the user who clicks on my link and arrives on an opened Facybox with the correct image I have no idea how to do that and if it's possible.
What I know:
I know that I have to have uniques URL for each images and I think I have it. ex from my site:
www.myURL.com/images/gallery/myimages_1.jpg
www.myURL.com/images/gallery/myimages_2.jpg
Is it correct?
I think I have to change the "this.href" in the sharer by the image url. First is it correct? And second (sorry I'm new in javascript) how can I do that?
I hope somebody could help me. Sorry for my English I'm trying to write my best English :)
If you need more information please do not hesitate.
Thanks
[EDIT]:
I add this script on the gallery page
$(function()
{
$('.thumbs').click(function()
{
$tempImgName = $(this).attr('id');
$tempUrl = this.href + '/images/thumbs/' + $tempImgName;
$meta = document.getElementById('facebook');
$meta.setAttribute("content",$tempUrl);
});
});
So when I click on a thumbsnail (with the class .thumbs) I get the image URL and I change the meta (with the facebook Id). It works but I think Facebook check the meta when the page load so how can I force Facebook to recheck my meta to take the good thumbs to share?
og:image cannot change by url. You need to give different share urls for different images.
For example :-
www.myURL.com/?pic=img1
www.myURL.com/?pic=img2 etc.
And a server side language ( like php ) can read the "pic" GET argument and change the og:image.

URL link in Rich Text inside of Webview

I have been trying to figure this one out for a while but I just can't seem to find an answer. I have an app that I am working on that contains rich text within a WebView, I would like to be able to add a hyperlink within that but I just don't know how.
This is my code:
+(NSArray*)getSampleData
{
NSString* content0 = #"<b><u>For Printer Models:</b></u> IJ2040, 3000, 3160. </p><p>Cable Part Number: CD-023A. </p><p>Connector: RJ12. </p><p>Interface Type: <ul><li><p>12 Volt MultiPRO II: 420</li></p><li><p>12/24 Volt MultiPRO III: 520.</ul></p><p>Manufacturer Website: www.addmaster.com";
}
BusinessService* service0 = [[BusinessService alloc] initWithCaption:#"Addmaster" andImage:[UIImage imageNamed:#"interface.jpg"] andWebContentTitle:#"Connectors for Addmaster" andWebContent:content0 andWebContentImage:[UIImage imageNamed:#"interface.jpg"]];
Now I would like to be able to link directly from the webview to www.addmaster.com so that anyone reading that, can just click on the link to open up safari. Please let me know if it is possible. Thank you very much for your help.

ZendFramework images not loading

I have a site I am developing in the ZendFramework and I have two social image pictures on the homepage. When I first load the page the images aren't there, however if I then click a link the images appear if I then click another link further into the site they disappear again, the images are in a div in the layout file they should be there all the time everything else in the layout file is apart from these.. I have been struggling on an issue of trying to echo image paths from a database in the src property of the tag and couldn't get it to work then I realized this was happening and I am assuming it has something to do with the social images problem as the page where I want the database images to appear doesn't have the social links either..
Sorry for the rant I just don't really know how to explain the problem, hope it comes across ok, if you need any more information on this matter don't hesitate to ask!
Thanks in advance!
Rik
When you echo the path to the image for the src attribute of the image tag, you should be using the baseUrl helper so the path is always absolute and references your base URL.
For example, you would call <?php echo $this->baseUrl('images/test.png') ?> and that will result in something like /zendapp/public/images or /images.
I suspect what is happening is the image tag looks something like this: <img src="images/thepic.png" />. You should make sure all images, CSS, Javascript references etc all use absolute paths like /images and avoid ../images, ./images, or images and the like.
Hope that helps.
If don't wont use native view helper function $this->baseUrl(). Just add slash before image url <img src="/images/thepic.png" alt="Some description" width="" heigth="" />

Tinymce - Convert image url to html image url

This is question about tinymce... Current image editor is slow for because it demands opening popup for every new picture I want to add. I have my own external image gallery where each image contains it's url so copy-paste of url's is very easy and fast...
I would like to have button similar to Bold that does following:
To editor I paste url of image (for example: www.site.com/image.jpg) and when i select this url and click on my new button it converts image url to <img src='www.site.com/image.jpg'> and shows image in editor.
I searched plugins and found nothing similar to this.
Any ideas?
Thanks in advance!
Ilija
solved!
In documentation there is example how to manipulate text in editor from external commands... end even set them as button