Image not rendering in meteor - node.js

I'm using collectionFs to upload and display images.
Everything works perfectly except that when I try to display the image in the template nothing happens.
If I write {{this.url}} the url displays perfectly
/cfs/files/images/GkPAjn98N6izJYc6x/blogging.jpg
However if I write <img src="{{this.url}}"> nothing happens
Any idea why this is?

If you inspect the element what you get?
you get <im src="/cfs/files/images/GkPAjn98N6izJYc6x/blogging.jpg"/>
Also be sure you have the allow download to true
Images.allow({
download:function(){return true;}
})
Check out this DEMO
NOTE: do a meteor list and check that you have the latest version of cfs:stander:packages and cfs:gridfs or filesystem

Related

Etherpad: setHTML API response is successful but updated html is not visible on etherpad

When I create a new pad and use newly created padID in /setHTML API, this updates HTML and updated
HTML is visible on pad. But, when I use the same process for a pad where I'm creating sessions etc the and use padID in /setHTML, this call is successful but updated HTML is not visible on the pad. However, this is getting saved in DB.
Please help!
Regards,
I've found the mistake which I was making in calling etherpad.The correct way is given below. This is working fine for me.
<iframe src='http://pad.domain/p/PAD_NAME?sessionID=sessionID&userName=userName&showChat=false&showLineNumbers=false' width=600 height=400></iframe>
PAD_NAME and padID are sam in my case. /setHTML is working fine when I use padID.

How to scrape image in ion-img if the src is php script which is generating captcha code

I'm scraping website for the college project which will be used to display the result.
The problem is the results are protected by a captcha code.
I tried scraping using the node HTML parser but when I extract src attribute it says captcha.php.
Inspect element of that captcha code image is below
<img src="captcha.php" class="control-label ">
const img = <HTMLElement[]><any>root.querySelectorAll('img') ;
console.log(img[1]);
let imgt1 =<HTMLImageElement> img[1];
let tmp3 =JSON.stringify(imgt1.attributes);
et con1 = JSON.parse(tmp3)
console.log(con1)
this.image= con1;
console.log(this.image.src)//output captcha.php
at the front end
<ion-img [src]="image.src"></ion-img>
and the front end image is not displaying and it showing broken image
what should I do?
edit:
website also uses cookies also 'PHPSESSID'
Just because the url of the element is pointing at a php file doesn't mean it's returning a php web page.
You can write php to return any type of data you want. In this case its returning an image.
You can try downloading the captcha.php file. In theory it should have an image contents inside of it but probably it will detect that the script is not being called from the right location and show some kind of error image.
The point of a captcha is to specifically stop this kind of thing. You are a robot trying to access the system. If it was a simple case of pulling the image out via a script then it would make the captcha system pretty pointless.
When you say this is for a college project, what do you mean? Is the project to try to break a captcha system? Or are you just trying to cheat somehow?

Using Cypress, how would I write a simple test to check that a logo image exists on a page

specifically, I would like to test that the logo appears on the home page of the app. I guess I am not sure what I should use to look for the image.
I tried
it('has a logo', function () {
cy.visit('http://localhost:3000')
cy.get('img').should('contains' , 'My-Logo.png')
})
instead of cy.get I also tried to just use
cy.contains('My-Logo.png')
but it also fails.
I wasn't sure what element I should use or if I should be using get, but it fails. When I look at the source code for the web page, the logo is hidden within the javascript (nodeJS, vueJS,and expressJS application) and I noticed the javascript seems to add a sequence of numbers and letters to the image when I go to the image page even though the image name in the assets folder does not have it on there. My-Logo.d63b7f9.png.
I figured out the solution on my own.
cy.get('form').find('img').should('have.attr', 'src').should('include','My-Logo')
I inspected the element and found the <img src... line was embedded within a <form>. I could do a cy.get('form') and pass, but could not do a cy.get('img') to pass. So then I chained them together and it passed. I am not sure why I cannot just simply add the second should statement, but it failed when I tried to just run:
cy.get('form').find('img').should('include','My-Logo')
I am not entirely sure why, but it needed the first "should" statement. I got around VUE adding the sequence of numbers and letters by just asking for the name of the file without the extension. I hope this maybe helps someone else as the documentation did not seem to cover this.
you can use only one should statement like:
cy.get('form').find('img').should('have.attr', 'src', 'My-Logo')
the third arg of should is the value to match with the element attribute.

Send path of SDWebImage stored image to a UIWebView

I need to be able to get a path to images that cached.
While I am wondering if there is a way to do this using SDWebImage, I could probably get away with just having the knowledge to return a path to an image stored in the cache so I can display it within a uiwebview inside an image tag.
According to this https://github.com/rs/SDWebImage/issues/25 it would seem you can simply refer to the image by it's original url and it will be correctly picked up from cache.

Uploading images in cloud9ide?

Anyone else can't upload via the drag and drop function images in clou9ide? The name of the image appears in the file browser in the ide, but the image is broken (displays the broken image icon, in chrome). In fifrefox I get HTTP error [24]:500 not_defined callback is not defined0.1. Ive reported it has a bug to cloud9, but no response and not a lot of other people complaining about this issue. Anyone knows if I am doing something wrong?
The drag and drop now works (well on the paid version). It was a un-implemented option at the time.

Resources