WebNative Portal Xinet - Grab image - php

I am trying to grab an image on my WebNative Xinet portal. When i use the method i am using right now: I get an image back, but i also get all the HTML with it to display the image. This is what i am using to grab the image right now:
GETIMAGE.php?type=small&path=/Images/myimage.png
This is kind of working. The issue with this is that it returns a complete HTML document with the image tags in it displaying the image.
How is it possible to get the raw image back with no HTML included? My main objective is to grab the image and encode it to base64 to be displayed in an e-mail.

That request should absolutely be giving you an HTTP response with an image payload.
I'm assuming you're using cURL to speak with Portal. Did you authenticate with server before making the GETIMAGE.php request? If so, are you including the session ID cookie in your GETIMAGE.php request?
EDIT: I saw your other post and it looks exactly like the auto-generated code Chrome shows in its DOM inspector. Are you sure you're getting HTML from that URL? I'm staring at the source and I can't find anywhere where it emits HTML.

Related

php:pass image as a parameter in get url

I wish to pass image in get url in php. Like how id is passed
For eg. http://myurl.com?id=1 . Similarly I wish to pass an entire image instead of the id.
How do I do it?
actually i have made a web service in php, and want to test it in browser. The service also contains an image to be passed and saved in database n also on server. So how do i do this?
You can convert your image to base64 code, and then send the code via GET. There's an easy to use image to base64 code converter at http://webcodertools.com/imagetobase64converter

Adding downloadlink using canvg and amcharts

I am trying to add a downloadlink to a page that uses AmCharts and CanVG.
The entire graph and img displaying part is all working correctly.
Now i need a downloadlink to provide the user with the image of the graph displayed.
i have already tried to create a HTML link element to the image, but at that moment, i get an error that says "Requested URI to long".
Also i have tried using a form, parsing the source from the image(obtained via jQuery) to a new page, and displaying it there, but also that won't work..
Anybody that can help me? every solution using html/php/jquery/javascript is perfectly fine.
As i have found out, this is not possible due to the length of the url. The best solution will be just to display the image in a div, next to the chart or underneath the chart, as a thumbnail. Trough there the user can just save it into their documents.

php ImageCreateFromPNG from dynamic url issue

I am trying to alter some images which are located in my attachments dir and pulled out by an attachment script. something like:
/attachment.php?attachmentid=543&d=1319371426&stc=1&fromvw=1
somehow the ImageCreateFromPNG doesnt want to recognize these links as a valid PNG
but when inspecting the image it IS valid..
for example: http://www.birthright.net/forums/attachment.php?attachmentid=543&d=1319371426&stc=1&fromvw=1
is there a way to "force" it as PNG? or any other solution for this?
That URL requires you to login first, that would require the server to authenticate with the vBulletin forums that Brightright uses and then you could receive the image. You could always do a CURL post to simulate a login using all the variables that the login form uses on that page. Then after you are logged in, you could get the image.
You are currently receiving HTML content of the login page, hence the "invalid" PNG!

Need some help in downloading pics from a website

I am looking for some help in downloading pics from a website. Here is the problem detail.
URL is basvandenbroek dot com,
suppose when we visit the following page http://www.basvandenbroek.com/nl/product/27341/704/snaarinstrumenten/boston/snarenset_elektrisch.html
we have a thumbnail pic here which when click bring its larger version. I would like to capture the larger image using a php script and download it onto my pc.
Problem is when we inspect the HTML we see the following code for images
../../../../../../../jpg/27000/27341.jpg
../../../../../../../jpg/cache/27000/220_220_27341.jpg
Based on the above code i assume that if i append website address at the start of the
jpg/27000/27341.jpg I could access the pic but its not working it that.
I believe URL is hidden or I might not understanding things properly. I am new to PHP and Scripting and I would like somebody to help me through it situation.
Thank you
For the website you mentioned, if the thumbnail is
http://www.basvandenbroek.com/jpg/cache/27000/220_220_27341.jpg
then the
http://www.basvandenbroek.com/jpg/27000/27341.jpg
So the thumbnail is basically the dimensions (220 x 220) added as a prefix to the original in a different folder. Also, there is nothing like hidden URL. Any link that is valid on a web-page is sure to appear in the source of the html. In chrome and firefox, atleat, you can find this link by right-clicking the link and copying the link address.
In your case you can find the thumbnail's url by right-clicking the thumbnail and the original's url by right-clicking it.
However, if you want to do this automatically using PHP, you will have to write code that can parse the html for the page to determine the urls.
In your example, here would be the larger image:
http://www.basvandenbroek.com/jpg/27000/27341.jpg
The smaller image is at:
http://www.basvandenbroek.com/jpg/cache/27000/220_220_27341.jpg
This means you would need to scrape out the first two underscored parts of the name (220_220) using string manipulation. You would also want to string replace "cache/" with an empty string.
relative urls are relative to the url of the containing document. so if the document you're scraping is located at http://example.com/foo/bar/baz/doc.html, and the image is referenced as
../../omg/wtf/lol/cat.jpeg, its full url is http://example.com/foo/bar/baz/../../omg/wtf/lol/cat.jpeg, or http://example.com/foo/omg/wtf/lol/cat.jpeg.
btw, this has nothing to do with PHP or scripting in general, and is instead firmly a HTTP thing. and there are no "hidden" URLs in HTTP, that would be a contradiction.
edit: your comment makes it look like the problem is with the Referer header or session id sent (or not) in your request.

Retrieve Title,Description and thumbnail of a url in php/Javascript/jqueryurl

As we post any url on facebook, it shows its meta-data(title, decription and thumbnail image), How can we achieve same thing in php or scripting language(javascript/jquery).
I believe, Facebook simply parses the html code of the Website behind the link and looks for <img /> tags. You can then choose any of the found images as picture for your link.
In PHP, you would fetch the websites HTML source via
$html = file_get_contents('http://...');
Then use regular expressions to find those <img /> tags.
you make an ajax hit to your server sending the URL
on the server side, get the url
parse it, extract the relevant info
send back the response as a either as JSON and parse it on the client side, either straight as HTML
There is a good plugin that can be used as a headstart.
It does not fetch the image, but it's a start if you want to implement your own
http://www.webinfopedia.com/extract-meta-data-from-url-using-php.html

Categories