MediaWiki talk:Gadget-GoogleImagesTineye.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Script broken if links array is empty[edit]

{{editprotected}} This script crashes on line 6 if the links array is empty, since it tries to access element -1 of the empty array. Please fix it e.g. by adding "if (!links.length) return" before line 6. Thank you. —Ilmari Karonen (talk) 14:05, 8 March 2009 (UTC)[reply]

Done --Mormegil (talk) 11:26, 29 March 2009 (UTC)[reply]

Broswer plugin[edit]

I just wanted to point out there's also a browser plugin for both Firefox and IE. Useful for when you're off Commons (like for checking Flickr or other wikis' images before uploading here). Rocket000 (talk) 18:25, 22 March 2009 (UTC)[reply]

Function[edit]

If I use the TinEye tab via this script, it comes back not finding any results. If I use my Firefox TinEye plugin on the same images, it finds matching results. At least that was the case for File:Genitaila-142736-52Y9s.jpg. - ALLSTRecho wuz here @ 20:55, 8 May 2009 (UTC)[reply]

Yeah, I'm getting the same result... the hashes are different. The Firefox plugin checks an image that's 453x285, 43.2 KB and this script checks an image that's 300x189, 6.8 KB, which is the thumbnail since that's what this script tells it to do for some reason. Still, they look the same so I would think Tineye would return similar results. Rocket000 (talk) 22:41, 8 May 2009 (UTC)[reply]
Looks like TinEye's being weird. For example, searching for the 120px or 110px thumbnails of that image turns up the same result as for the full image, but the 100px thumbnail gives no results. Maybe it's having difficulty matching the images (which seems odd, since it looks like just a simple crop, but image matching is tricky stuff), and the small variations introduced by the scaling are sometimes enough to throw it off. Or else it might be an index coherency issue: the link given for the matching image returns a 404, so it might be that it was removed and only some of TinEye's servers still have it in their index. If TinEye is using the hash to pick the server to query, that could explain why the results are different. (Admittedly, that might be complete nonsense — I have no idea how TinEye's servers are set up or what, if any, load balancing they're doing.) Anyway, this doesn't look like a problem with the script. —Ilmari Karonen (talk) 10:04, 9 May 2009 (UTC)[reply]

Zoom[edit]

The new zoom gadget seems to interfere with this gadget. I mentioned this at COM:VP -- User:Docu at 15:01, 22 March 2010 (UTC)[reply]

Should be fixed. Lupo 16:21, 22 March 2010 (UTC)[reply]
Thanks. It works Disclaimer: In the test I did in one browser. -- User:Docu at 16:22, 22 March 2010 (UTC)[reply]
You guys are quick :-). Was exactly was interfering? --Dschwen (talk) 16:30, 22 March 2010 (UTC)[reply]
The URL built by this gadget started using the one to your viewer. -- User:Docu at 16:39, 22 March 2010 (UTC)[reply]
Right. For some reason, this gadget just used the last link inside the div#file to get a uri pointing to the image. Previously, that was the link to the full resolution (from which it then constructed a 300px-thumbnail URL), but now that's the zoom gadget's "no flash" link. I've now just made this gadget use the img.src, which should be good enough for tineye. Lupo 16:45, 22 March 2010 (UTC)[reply]
It seems to have a similar problem.  Docu  at 07:00, 5 September 2010 (UTC)[reply]
Tell User:Platonides: [1]. Lupo 07:54, 6 September 2010 (UTC)[reply]
✓ Done. I hadn't noticed it was recently edited.  Docu  at 16:45, 6 September 2010 (UTC)[reply]
These days you can't trust things to stay at any position... Fixed. Platonides (talk) 21:56, 8 September 2010 (UTC)[reply]
Great, thanks. It works again.  Docu  at 10:34, 9 September 2010 (UTC)[reply]

{{editprotected}} In combination I was testing mwEmbedd I noticed this problem in the tineye gadget, dunno what the cause is though.

imageurl is undefined
http://bits.wikimedia.org/commons.wikimedia.org/load.php?debug=true&modules=ext.gadget.Tineye&only=scripts&skin=vector&user=&version=20111012T021659Z&*
Line 18

{{Editprotected}} is merely to get yee attention, as I've no idea atm. how to fix this correctly (could be a combination of my current setup of gadgets). AzaToth 17:21, 13 October 2011 (UTC)[reply]

✓ Done Hopefully fixed. --Mormegil (talk) 15:27, 17 October 2011 (UTC)[reply]

Proposal to add more search engines[edit]

FTR, there's currently a proposal to add Yandex and maybe Bing reverse image searches going on at VP/P. El Grafo (talk) 09:10, 15 September 2022 (UTC)[reply]

Proposal archived here. 5  Support votes, no objections. El Grafo (talk) 16:07, 18 November 2022 (UTC)[reply]
It is requested that an edit or modification be made to this protected page.
Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

RZuo

proposal 1: add the following codes at line 36
portletLink = mw.util.addPortletLink('p-cactions', 'https://yandex.com/images/search?rpt=imageview&url=' + encodeURIComponent(imgURL), 'Yandex', 'ca-yandex', null);
if(portletLink && portletLink.children[0]) portletLink.children[0].target = '_blank';
supported by a majority: Commons:Village_pump/Proposals/Archive/2022/09#Add_yandex_to_reverse_image_search_gadget.
since there will be 3 websites, proposal 2: change the name of the gadget to Gadget-ReverseImageSearch.js by moving and editing the relevant pages. RZuo (talk) 10:38, 18 September 2022 (UTC)[reply]
 Support, with an option to shorten the tab names.   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 13:34, 14 November 2022 (UTC)[reply]
This makes even more sense with the name change to Google Lens.   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 11:34, 18 November 2022 (UTC)[reply]
 Support please add Yandex and Bing, agree with the rename. El Grafo (talk) 16:05, 18 November 2022 (UTC)[reply]

Google Images searches failing[edit]

All Google Images searches are failing, with return of https://www.google.com/imghp?sbi=1 with no meaningful results.   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 13:35, 14 November 2022 (UTC)[reply]

Google is redirecting to Google Lens now. You can still search by pasting a picture URL there, but so far I could not figure out if you can also submit that URL as a parameter. https://www.google.com/searchbyimage?image_url=https://foo/bar.JPG does not work any more. Interestingly, on the Google Lens results page there's a link to the old reverse image search results ("Find image source"). El Grafo (talk) 10:08, 16 November 2022 (UTC)[reply]
@El Grafo: You may have to drag the white curved corners to the actual corners of the image in order to best reproduce the old reverse image search results. Or does that only affect the results on the right in Google Lens?   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 12:41, 16 November 2022 (UTC)[reply]
No idea. Point is that we don't know if/how we can pass an image URL on to Google via URL parameter any more. So manual copy & paste works in principal, but we can't fix the gadget. El Grafo (talk) 15:33, 16 November 2022 (UTC)[reply]
@El Grafo Perhaps we could get the gadget to copy the current URL of the full image to the clipboard on the way to Google?   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 15:36, 16 November 2022 (UTC)[reply]
That might get us halfway there ... no idea if that's feasible, I don't do JS. Side note: as far as I understand. looking images up in Google Lens from the right click menu should be/become possible for Chrome users. El Grafo (talk) 15:47, 16 November 2022 (UTC)[reply]
@El Grafo: Yes, that works after a fashion (but only in Chrome and with max 1,000 × 1,000 pixels resolution, resulting in URLs like https://lens.google.com/search?p=AcLkwR3vu6c7J9acf6Xb01CBix673qmJBO04xKtXvggn7BiizZDWyAn01EhSYI6o1XGJS-MdTtdXCvONG778VECKe-U9UyV5ynk4siqB-bhWB78SwFvRhfjldOH1ryxNdbYJubeQMoq08kVS4qUlXibeABbwOb3-6qt6GA7f2jM5HbAtXy6AX7CqqxiogyK9dkCvstVYX35av-gLtClFwdynuNSQuEjr6ZGVI3-zReFfF8VuxZNPHMAzmUBABIDU6sWYkVcnd_HKH2A-6LvDsZJu8YwKRE7EeZ-yJYqID-bZfenfhEDBqpm0v2SAICe7J_orE8qMLbRtASJ0OsfSMJaeoxfFOX_pywTCORxu39JJHu2QF8jJ1tAnnCAS6w%3D%3D&ep=cnts&re=df&s#lns=W251bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsIkVrY0tKR1ppTmpoa05tTTVMV1F4WldFdE5HWTFNaTFoTWpRMUxUUmpZVEF5TmpjMU1qQm1NeElmWnpVeWIySkxkbUpmWDAxUlJVWkRjWGQ0VEhKTVVEUkxkVE5WVlZOQ1p3PT0iXQ== and https://www.google.com/search?tbs=sbi:AMhZZitGrqb5ipPaBl01Rq34TUXqsILceW8n1IIvYOER2UBtVCw5TcMSqq4iEd7pq9tmq6qAeANt3R_1VGVVF0wHd-GunZV6DvG9dyyydtKsY4X2geUHVqFpZi0ne9g2aitzcCfy0je6Lx1vMcsgP8d9SXs2aK41lRA ).   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 16:30, 16 November 2022 (UTC)[reply]
Ha! This works: lens.google.com/uploadbyurl?url=. Leads you to the Google lens results, then the old image search results are only one click away: https://lens.google.com/uploadbyurl?url=https://upload.wikimedia.org/wikipedia/commons/f/f4/Frans_Huygelen%27s_Prometheus%2C_rear_view.jpg. I guess that's something we could live with. El Grafo (talk) 11:18, 18 November 2022 (UTC)[reply]
@El Grafo: how did you figure this out?😂--RZuo (talk) 15:37, 18 November 2022 (UTC)[reply]
I didn't, just found someone who had the same problem ;-) El Grafo (talk) 16:08, 18 November 2022 (UTC)[reply]

{{Edit request}} see above: I suppose replacing

var portletLink = mw.util.addPortletLink('p-cactions', 'https://www.google.com/searchbyimage?image_url=' + encodeURIComponent(imgURL), 'Google Images', 'ca-googleimages', null);

by

var portletLink = mw.util.addPortletLink('p-cactions', 'https://lens.google.com/uploadbyurl?url=' + encodeURIComponent(imgURL), 'Google Lens', 'ca-googleimages', null);

should solve the issue. --El Grafo (talk) 11:21, 18 November 2022 (UTC)[reply]

✓ Done --Didym (talk) 11:30, 18 November 2022 (UTC)[reply]
@Didym and @El Grafo: Thank you both for your help with this!   — 🇺🇦Jeff G. please ping or talk to me🇺🇦 11:33, 18 November 2022 (UTC)[reply]
i found a solution on https://github.com/ccd0/4chan-x/issues/3307 .
example: https://www.google.com/searchbyimage?sbisrc=69&image_url=https://upload.wikimedia.org/wikipedia/commons/f/f3/President_Tsai_Ing-wen_20201204_01.jpg for File:President Tsai Ing-wen 20201204 01.jpg. RZuo (talk) 15:47, 18 November 2022 (UTC)[reply]
That looks like a better solution. Do we still want to keep the Lens option in addition to that, thou? It may come in hand on occasion when checking composites like collages ... El Grafo (talk) 15:53, 18 November 2022 (UTC)[reply]
i suggest keeping both. i just used lens to identify File:Sun (195390785).jpeg's subject successfully. it wouldnt work with the old searchbyimage. RZuo (talk) 18:05, 1 January 2023 (UTC)[reply]
1 more reason to keep google lens: you can use it to easily OCR and translate texts in the image. RZuo (talk) 14:54, 22 April 2024 (UTC)[reply]