How to get images from Blizzard Community Platform - api

We can get some information by json.
But how can i get images by the information in json.
e.g. "thumbnail": "medivh/1/1-avatar.jpg"
It does not work when i concat the url behind the host + request.
So, is there some other way to get images?

The url for the static images has the following format:
http:// REGION . battle.net/static-render/ REGION / THUMBNAIL
Example:
For the avatar image
http://eu.battle.net/static-render/eu/alexstrasza/57/51685945-avatar.jpg
The picture you see when you visit your armory profile
http://eu.battle.net/static-render/eu/alexstrasza/57/51685945-profilemain.jpg
Another angle, I don't know where this is used
http://eu.battle.net/static-render/eu/alexstrasza/57/51685945-inset.jpg

As of the latest changes to the static renderer, the following is correct:
http://render-<Region>.worldofwarcraft.com/character/<Thumbnail>
For example:
http://render-us.worldofwarcraft.com/character/kul-tiras/148/130814612-profilemain.jpg

Related

how to display binary field data in website using a controller odoo 13

I was creating a controller to gets information from custom module and wonted to display the pdf or image on the website how to get the url.
I was able to download it using this
return http.send_file(maybefiel, filename='sdsdds', as_attachment=False)
but I wonted to display it can you please help
You can access a binary field using the following path:
your_url/web/content/model_name/id/field_name
For example, the field name of a user's profile picture is called "image", so, the URL looks like something like this:
http://localhost:8069/web/content/res.users/1/image
Where 1 is the user id.

Access the image URL of a product

I am trying to get the image URL inside Edit Theme Files -> product.html
I already have some values like:
{{product.title}}, that gives me "Product name"
{{product.url}}, that gives me the URL
etc...
but no matter what i try, i can't get the URL.
The closest I got was using this: {{product.main_image.data}}
which gives me something like this:
https://cdn3.bigcommerce.com/s-8lxh1/images/stencil/%7B:size%7D/products/882/1700/RAM_VB_193_SW1__09586.1463668242.jpg?c=2
But that does not produce a image link.
Would appreciate any help or insights.
Thanks in advance!
The string that you're returning doesn't work because there's a "size" placeholder embedded in the URL. You can use Stencil's getImage Handlebars helper to specify the image dimensions and return a working URL:
{{getImage product.main_image.data "thumbnail"}}
The "thumbnail" string specifies an image size that exists in your theme settings. You can also specify a numeric size, like "200x200". Check out the docs here

Displaying jpegPhoto attribute from LDAP in Websphere Portal

I have a requirement wherein I need to display details of users after searching from LDAP using PUMA API.
I'm having troubling displaying the jpegPhoto of the user.
Here's what I'm doing:
First I'm querying the user by using:
PumaLocator.findUsersByAttribute(uid, user);
After that we get a User list Object.
For each user, we fetch all the attributes which is in the form of a Map.
I'm getting the following value for while retrieving the jpegPhoto:
map.get("jpegPhoto") --> [B#7a2f8a54
It seems that the Puma API returns a Binary string. Does anyone know how to display this in the portlet?
Any help would be greatly appreciated. Thank you
I think it more likely this is a byte[] array than a string.
You can probably base64 encode this binary into an encoded string and use it in an HTML image tag.
byte[] photoBytes = (byte[]) map.get("jpegPhoto");
String encodedPhoto = org.apache.commons.codec.binary.Base64.encodeBase64(photoBytes);
Then later, perhaps in a JSP (example assumes JSTL variable in scope named encodedPhoto):
<img src="data:image/jpeg;base64,${encodedPhoto}"/>
A way of doing this is to access the image through the portal service servlet instead of using your own servlet: /wps/um/secure/users/profiles/[oid]/jpegPhoto, in which you replace [oid] with the ObjectID of the user. This ID string can be obtained using IdentificationMgr.getIdentification().serialize(user.getObjectID())
The photo of the current user you can access using: /wps/um/secure/currentuser/profile/jpegPhoto
Portal is giving you data as byte array. It will never give you as URL.
You can write a servlet which will write this byte array to output stream.
Use that servlet URL as src of tag. It will start rendering on browser.
FYI, you can't print byte array to browser and expect it to treat as image.
Image or any other files has to come as a resource not as content.

Rails default image absolute URL

I have a newbie question:
I'm storing a default URL (pointing to an image that's stored on server) as the default image for a model, such as /assets/project_default.png. The user can also set the URL to a remote URL as well.
How do I display the URL as an absolute URL so it's http://xxxxxx.com//assets/project_default.png but also support a user's remote URL?
If I use "#{request.protocol}#{request.host_with_port}, that'll always apply. I'd like to apply only if the URL isn't remote.
Cheers,
Assuming I'm reading your question right, you could do something like...
application_helper.rb
def absolute_image_url (url)
if url[0] == "/"
return "#{request.protocol}#{request.host_with_port}" + url
else
return url
end
end
Or add it into the model, etc.

What does visibleContentsAsDataURL exactly do?

I am currently trying to build my first Safari extension. The SafariBrowserTab Class has a Method called "visibleContentsAsDataURL".
I don't exactly understand what it does and can't get it to work.
The docs just say: "Returns a data URL for an image of the visible contents of the tab."
What does it mean? That I get the URL of a screenshot of the tabs' content back? Can someone explain me?
Thanks!
I think it returns what is effectively a screenshot of the tab. The format is explained here
http://en.wikipedia.org/wiki/Data_URI_scheme
According to Apple's Safari reference documentation the return value is "a base-64 encoded PNG."
A data URL is a specal type of url basically consisting of a mimetype and data, in the case of png you'll get something along the lines of:
data:image/png;base64;lotsofstuff
You can then do whatever you want with it (it's just a string), or if you want to display the content:
img = new Image();
img.src = someTab.visibleContentsAsDataURL();
someElement.appendChild(img);
or
someCanvasContext.drawImage(img);
etc