Related
When I get track.search or user.getLovedTracks response, they have an image, but if I saw on any of the provided links then there will be a white image with a star, although if I go to my loved tracks page in lastfm the images will be correct.
For the example.
At lastfm:
https://i.stack.imgur.com/OKc5e.png
link to image: https://lastfm.freetls.fastly.net/i/u/64s/9c7a96efcdfa4e03cc8e1b65daac5281.jpg
At my service:
https://i.stack.imgur.com/dpIhj.png
link to image in request response: https://lastfm.freetls.fastly.net/i/u/64s/2a96cbd8b46e442fc41c2b86b821562f.png
The api returns a whole array of links to images, but they are all incorrect
https://i.stack.imgur.com/Uiwrl.png
If you send a request with the track.getInfo method will response like:
{
"track": {
"name": "Без ключа",
"url": "https://www.last.fm/music/Pharaoh/_/%D0%91%D0%B5%D0%B7+%D0%BA%D0%BB%D1%8E%D1%87%D0%B0",
"duration": "159000",
"streamable": {
"#text": "0",
"fulltrack": "0"
},
"listeners": "10491",
"playcount": "78974",
"artist": {
"name": "Pharaoh",
"mbid": "a6ed750a-7293-4e08-ba03-832373eb136b",
"url": "https://www.last.fm/music/Pharaoh"
},
"album": {
"artist": "Pharaoh",
"title": "Правило",
"url": "https://www.last.fm/music/Pharaoh/%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D0%BE",
"image": [{
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "small"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "medium"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "large"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "extralarge"
}]
},
"toptags": {
"tag": []
}
}
}
and the links in the album image will be correct
I am trying to fish data with images but how can I do two map inside each othe I need only the first image from every item
here is the JSON file
`
"items": Array [
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/5staYrHq4jR1NiBfRR2XWr",
},
"followers": Object {
"href": null,
"total": 433,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/5staYrHq4jR1NiBfRR2XWr",
"id": "5staYrHq4jR1NiBfRR2XWr",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab6761610000e5eb038f9071ec89962e7ad16b77",
"width": 640,
},
Object {
"height": 320,
"url": "https://i.scdn.co/image/ab67616100005174038f9071ec89962e7ad16b77",
"width": 320,
},
Object {
"height": 160,
"url": "https://i.scdn.co/image/ab6761610000f178038f9071ec89962e7ad16b77",
"width": 160,
},
],
"name": "DOXX",
"popularity": 6,
"type": "artist",
"uri": "spotify:artist:5staYrHq4jR1NiBfRR2XWr",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/1MVFEpYdHtdV3k8Bgs79Pl",
},
"followers": Object {
"href": null,
"total": 404,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/1MVFEpYdHtdV3k8Bgs79Pl",
"id": "1MVFEpYdHtdV3k8Bgs79Pl",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab6761610000e5ebd1578a57ff89ac9aeed23863",
"width": 640,
},
Object {
"height": 320,
"url": "https://i.scdn.co/image/ab67616100005174d1578a57ff89ac9aeed23863",
"width": 320,
},
Object {
"height": 160,
"url": "https://i.scdn.co/image/ab6761610000f178d1578a57ff89ac9aeed23863",
"width": 160,
},
],
"name": "DOXY",
"popularity": 14,
"type": "artist",
"uri": "spotify:artist:1MVFEpYdHtdV3k8Bgs79Pl",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/1HliyC4gHWRHHFy3CjR3Bp",
},
"followers": Object {
"href": null,
"total": 2,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/1HliyC4gHWRHHFy3CjR3Bp",
"id": "1HliyC4gHWRHHFy3CjR3Bp",
"images": Array [],
"name": "Doxy601",
"popularity": 5,
"type": "artist",
"uri": "spotify:artist:1HliyC4gHWRHHFy3CjR3Bp",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/7d8a8D8ZfVdYsuAcMk4Kxy",
},
"followers": Object {
"href": null,
"total": 97,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/7d8a8D8ZfVdYsuAcMk4Kxy",
"id": "7d8a8D8ZfVdYsuAcMk4Kxy",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b2736862f6dfd64d0c65d70c4623",
"width": 640,
},
Object {
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e026862f6dfd64d0c65d70c4623",
"width": 300,
},
Object {
"height": 64,
"url": "https://i.scdn.co/image/ab67616d000048516862f6dfd64d0c65d70c4623",
"width": 64,
},
],
"name": "Miles Davis & Milt Jackson",
"popularity": 5,
"type": "artist",
"uri": "spotify:artist:7d8a8D8ZfVdYsuAcMk4Kxy",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/6NrhhuvYUPDmZ7RiZAWQih",
},
"followers": Object {
"href": null,
"total": 546,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/6NrhhuvYUPDmZ7RiZAWQih",
"id": "6NrhhuvYUPDmZ7RiZAWQih",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab6761610000e5ebe2cae73d43e39e83aebc2bf5",
"width": 640,
},
Object {
"height": 320,
"url": "https://i.scdn.co/image/ab67616100005174e2cae73d43e39e83aebc2bf5",
"width": 320,
},
Object {
"height": 160,
"url": "https://i.scdn.co/image/ab6761610000f178e2cae73d43e39e83aebc2bf5",
"width": 160,
},
],
"name": "DOX",
"popularity": 25,
"type": "artist",
"uri": "spotify:artist:6NrhhuvYUPDmZ7RiZAWQih",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/6792Ts7YzD8dhGkgSHPNEL",
},
"followers": Object {
"href": null,
"total": 125,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/6792Ts7YzD8dhGkgSHPNEL",
"id": "6792Ts7YzD8dhGkgSHPNEL",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b273e2318a139e0f022870baac23",
"width": 640,
},
Object {
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e02e2318a139e0f022870baac23",
"width": 300,
},
Object {
"height": 64,
"url": "https://i.scdn.co/image/ab67616d00004851e2318a139e0f022870baac23",
"width": 64,
},
],
"name": "Miles Davis And Milt Jackson Sextet",
"popularity": 1,
"type": "artist",
"uri": "spotify:artist:6792Ts7YzD8dhGkgSHPNEL",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/2b69LpXVfEagXEJpHjj3vW",
},
"followers": Object {
"href": null,
"total": 10,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/2b69LpXVfEagXEJpHjj3vW",
"id": "2b69LpXVfEagXEJpHjj3vW",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab6761610000e5eb634c7182d6152094085cf475",
"width": 640,
},
Object {
"height": 320,
"url": "https://i.scdn.co/image/ab67616100005174634c7182d6152094085cf475",
"width": 320,
},
Object {
"height": 160,
"url": "https://i.scdn.co/image/ab6761610000f178634c7182d6152094085cf475",
"width": 160,
},
],
"name": "XODUS MMXXI",
"popularity": 12,
"type": "artist",
"uri": "spotify:artist:2b69LpXVfEagXEJpHjj3vW",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/1IhDCe20UkuG9o00cnhvS8",
},
"followers": Object {
"href": null,
"total": 106,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/1IhDCe20UkuG9o00cnhvS8",
"id": "1IhDCe20UkuG9o00cnhvS8",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b273802c20b22f713bf4ca551ea9",
"width": 640,
},
Object {
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e02802c20b22f713bf4ca551ea9",
"width": 300,
},
Object {
"height": 64,
"url": "https://i.scdn.co/image/ab67616d00004851802c20b22f713bf4ca551ea9",
"width": 64,
},
],
"name": "Doxi",
"popularity": 11,
"type": "artist",
"uri": "spotify:artist:1IhDCe20UkuG9o00cnhvS8",
},
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/0joBZjd7WSxAGlRC2pvaJM",
},
"followers": Object {
"href": null,
"total": 0,
},
"genres": Array [],
"href": "https://api.spotify.com/v1/artists/0joBZjd7WSxAGlRC2pvaJM",
"id": "0joBZjd7WSxAGlRC2pvaJM",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b27375b17d2e3f94ae1bddd65046",
"width": 640,
},
Object {
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e0275b17d2e3f94ae1bddd65046",
"width": 300,
},
Object {
"height": 64,
"url": "https://i.scdn.co/image/ab67616d0000485175b17d2e3f94ae1bddd65046",
"width": 64,
},
],
"name": "Prod.Dozy",
"popularity": 1,
"type": "artist",
"uri": "spotify:artist:0joBZjd7WSxAGlRC2pvaJM",
},
`
I did this to map data {items.map((data,i)=>({data.name}))}
I do this and it works but I want also to get the first image for each item can I do two maps inside each other ??
but how I can get these data with the first image for every item
You can load multiple items from an array using just one map.
To get the first image of every item you'll have to access the first item from the image array [0] and from that image you'll need the url to fill the source property of an <Image/> component (from React Native). You'll also need to supply the width and height to the style property like so:
{items.map((data) => ( <>
<Image style={{width: `${data.images[0].width}`, height: `${data.images[0].height}` }} source={require(`${data.images[0].url}`)}/>
<div>{data.name}</div> </>))}
I also wrapped Image and div in a React fragment: <></>
I know it's a similar question to others here but none of the previous solutions were successful for me.
I have a gallery page that works well getting the collections from Strapi, opening a dynamic page but I can't manage how to show the images there.
I'm calling my gallery and getting all the details but IDK how to show it in the correct way on the v-for
Here's how I'm calling the specific gallery (_slug.vue page)
async asyncData({ $strapi, params }) {
const gallery = await $strapi.find("galleries", {
slug: params.slug
});
console.log(gallery);
return {
gallery
};
},
And here how I'm I'm trying to display it
<h2 class="text-2xl font-normal text-gray-600 mt-12 mb-3">{{ gallery.title }}</h2>
<p class="mb-10 text-lg font-light text-gray-700">{{ gallery.description }}</p>
<div class="inline-flex flex-wrap">
<div v-for="item of gallery" class="w-full md:w-1/2 lg:w-1/3 xl:1/4 p-4">
<img
class="w-full h-96 object-cover rounded transition ease-in-out transform hover:-translate-y-1 hover:shadow-xl hover"
:src="$config.strapiUrl + item.gallery.images[0].url"
alt=""
/>
</div>
</div>
The $config.strapiUrl URL variable works well on all other pages. I don't believe the issue is with that but how I'm calling/or not calling. I'm not getting any images, title nor description but they are on the API response.
API Response I'm getting is
[
{
"id": 6,
"title": "Gallery 2",
"description": "Description here",
"published_at": "2021-10-23T20:47:50.752Z",
"created_at": "2021-10-23T20:47:46.503Z",
"updated_at": "2021-10-23T20:53:51.527Z",
"slug": "gallery-2",
"images": [
{
"id": 169,
"name": "002_01.jpg",
"alternativeText": "",
"caption": "",
"width": 1600,
"height": 1066,
"formats": {
"large": {
"ext": ".jpg",
"url": "/uploads/large_002_01_6943cf5aac.jpg",
"hash": "large_002_01_6943cf5aac",
"mime": "image/jpeg",
"name": "large_002_01.jpg",
"path": null,
"size": 74.3,
"width": 1000,
"height": 666
},
"small": {
"ext": ".jpg",
"url": "/uploads/small_002_01_6943cf5aac.jpg",
"hash": "small_002_01_6943cf5aac",
"mime": "image/jpeg",
"name": "small_002_01.jpg",
"path": null,
"size": 25.5,
"width": 500,
"height": 333
},
"medium": {
"ext": ".jpg",
"url": "/uploads/medium_002_01_6943cf5aac.jpg",
"hash": "medium_002_01_6943cf5aac",
"mime": "image/jpeg",
"name": "medium_002_01.jpg",
"path": null,
"size": 46.64,
"width": 750,
"height": 500
},
"thumbnail": {
"ext": ".jpg",
"url": "/uploads/thumbnail_002_01_6943cf5aac.jpg",
"hash": "thumbnail_002_01_6943cf5aac",
"mime": "image/jpeg",
"name": "thumbnail_002_01.jpg",
"path": null,
"size": 8.53,
"width": 234,
"height": 156
}
},
"hash": "002_01_6943cf5aac",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 164.23,
"url": "/uploads/002_01_6943cf5aac.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2021-10-23T18:37:15.745Z",
"updated_at": "2021-10-23T18:37:15.842Z"
},
{
"id": 178,
"name": "002_02.jpg",
"alternativeText": "",
"caption": "",
"width": 1600,
"height": 1066,
"formats": {
"large": {
"ext": ".jpg",
"url": "/uploads/large_002_02_32ff961c52.jpg",
"hash": "large_002_02_32ff961c52",
"mime": "image/jpeg",
"name": "large_002_02.jpg",
"path": null,
"size": 117.43,
"width": 1000,
"height": 666
},
"small": {
"ext": ".jpg",
"url": "/uploads/small_002_02_32ff961c52.jpg",
"hash": "small_002_02_32ff961c52",
"mime": "image/jpeg",
"name": "small_002_02.jpg",
"path": null,
"size": 33.45,
"width": 500,
"height": 333
},
"medium": {
"ext": ".jpg",
"url": "/uploads/medium_002_02_32ff961c52.jpg",
"hash": "medium_002_02_32ff961c52",
"mime": "image/jpeg",
"name": "medium_002_02.jpg",
"path": null,
"size": 68.17,
"width": 750,
"height": 500
},
"thumbnail": {
"ext": ".jpg",
"url": "/uploads/thumbnail_002_02_32ff961c52.jpg",
"hash": "thumbnail_002_02_32ff961c52",
"mime": "image/jpeg",
"name": "thumbnail_002_02.jpg",
"path": null,
"size": 8.68,
"width": 234,
"height": 156
}
},
"hash": "002_02_32ff961c52",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 247.96,
"url": "/uploads/002_02_32ff961c52.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2021-10-23T18:37:20.647Z",
"updated_at": "2021-10-23T18:37:20.850Z"
},
{
"id": 183,
"name": "002_04.jpg",
"alternativeText": "",
"caption": "",
"width": 1600,
"height": 1066,
"formats": {
"large": {
"ext": ".jpg",
"url": "/uploads/large_002_04_863abe8b86.jpg",
"hash": "large_002_04_863abe8b86",
"mime": "image/jpeg",
"name": "large_002_04.jpg",
"path": null,
"size": 122.13,
"width": 1000,
"height": 666
},
"small": {
"ext": ".jpg",
"url": "/uploads/small_002_04_863abe8b86.jpg",
"hash": "small_002_04_863abe8b86",
"mime": "image/jpeg",
"name": "small_002_04.jpg",
"path": null,
"size": 32.98,
"width": 500,
"height": 333
},
"medium": {
"ext": ".jpg",
"url": "/uploads/medium_002_04_863abe8b86.jpg",
"hash": "medium_002_04_863abe8b86",
"mime": "image/jpeg",
"name": "medium_002_04.jpg",
"path": null,
"size": 68.82,
"width": 750,
"height": 500
},
"thumbnail": {
"ext": ".jpg",
"url": "/uploads/thumbnail_002_04_863abe8b86.jpg",
"hash": "thumbnail_002_04_863abe8b86",
"mime": "image/jpeg",
"name": "thumbnail_002_04.jpg",
"path": null,
"size": 8.61,
"width": 234,
"height": 156
}
},
"hash": "002_04_863abe8b86",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 280.6,
"url": "/uploads/002_04_863abe8b86.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2021-10-23T18:37:22.628Z",
"updated_at": "2021-10-23T18:37:22.931Z"
}
],
"cover_image": {
"id": 167,
"name": "002_10.jpg",
"alternativeText": "",
"caption": "",
"width": 1600,
"height": 1066,
"formats": {
"large": {
"ext": ".jpg",
"url": "/uploads/large_002_10_b20570c2ca.jpg",
"hash": "large_002_10_b20570c2ca",
"mime": "image/jpeg",
"name": "large_002_10.jpg",
"path": null,
"size": 59.87,
"width": 1000,
"height": 666
},
"small": {
"ext": ".jpg",
"url": "/uploads/small_002_10_b20570c2ca.jpg",
"hash": "small_002_10_b20570c2ca",
"mime": "image/jpeg",
"name": "small_002_10.jpg",
"path": null,
"size": 20.34,
"width": 500,
"height": 333
},
"medium": {
"ext": ".jpg",
"url": "/uploads/medium_002_10_b20570c2ca.jpg",
"hash": "medium_002_10_b20570c2ca",
"mime": "image/jpeg",
"name": "medium_002_10.jpg",
"path": null,
"size": 37.45,
"width": 750,
"height": 500
},
"thumbnail": {
"ext": ".jpg",
"url": "/uploads/thumbnail_002_10_b20570c2ca.jpg",
"hash": "thumbnail_002_10_b20570c2ca",
"mime": "image/jpeg",
"name": "thumbnail_002_10.jpg",
"path": null,
"size": 6.71,
"width": 234,
"height": 156
}
},
"hash": "002_10_b20570c2ca",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 130.19,
"url": "/uploads/002_10_b20570c2ca.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"created_at": "2021-10-23T18:37:13.658Z",
"updated_at": "2021-10-23T18:37:13.941Z"
}
}
]
Okay, Here's how I solved it:
I was getting the wrong object calling slug on the function when the Strapi relies on the ID
The first step was changing the findOne function to get the slug and not the ID following this video here
https://www.youtube.com/watch?v=gtvXiRqn0ZI
with this piece of code:
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
/**
* Retrieve a record.
*
* #return {Object}
*/
async findOne(ctx) {
const { slug } = ctx.params;
const entity = await strapi.services.restaurant.findOne({ slug });
return sanitizeEntity(entity, { model: strapi.models.restaurant });
},
};
Then I started to get the correct data for the title and description.
On the Nuxt side the v-for was updated to:
v-for='image of gallery.images'
And the image tag:
<img class="w-full h-96 object-cover rounded transition ease-in-out transform hover:-translate-y-1 hover:shadow-xl hover" :src="$config.strapiUrl + image.url" alt="" />`
Thanks to #IAmRoot from Strapi - Discord who helped me on that too.
I might miss some basic vue.js knowledge, but I have the following question related to <picture> and specifically srcset
I have different formats of the same image coming from my api, like this:
"posts": [
{
"image": {
"formats": {
"thumbnail": {
"hash": "thumbnail_image",
"ext": ".png",
"mime": "image/png",
"width": 245,
"height": 138,
"size": 76.89,
"url": "/uploads/thumbnail_image.png"
},
"large": {
"hash": "large_image",
"ext": ".png",
"mime": "image/png",
"width": 1000,
"height": 563,
"size": 916.23,
"url": "/uploads/large_image.png"
},
"medium": {
"hash": "medium_image",
"ext": ".png",
"mime": "image/png",
"width": 750,
"height": 422,
"size": 562.28,
"url": "/uploads/medium_image.png"
},
"small": {
"hash": "small_image",
"ext": ".png",
"mime": "image/png",
"width": 500,
"height": 281,
"size": 275.16,
"url": "/uploads/small_image.png"
}
}
}
},
The final results I want to obtain is something like:
<picture>
<source srcset="https://apiurl.com/large_image.png 1000w, https://apiurl.com/medium_image.png 750w, https://apiurl.com/small_image.png 500w" />
</picture>
I am already passing all of the formats as a prop into the component, so they are all stored as "images"
basically what I would like is to have a single source that can loop through the formats (not necessarily there's always large or small) and add the URL inside :srcset.
Of course I am able to do
<source v-for="format in images" :srcset="apiUrl + format.url">
which works but generates multiple source
What's the best approach or solution for this situation?
Thanks
Simple Solution:
If you don't want to use computed or a component, you could just use a method where you pass a post and it returns the srcset urls.
methods: {
postSrcSetUrls(post) {
if (!post || !post.image || !post.image.formats)
return null;
let sizes = Object.keys(post.image.formats);
return sizes.map(size => `${post.image.formats[size].url} ${post.image.formats[size].width}w`).join(", ");
}
}
Then, in your template
<picture v-for="post in posts">
<source :srcset="postSrcSetUrls(post)" />
</picture>
Computed / Component Solution:
I would make a component and use a computed property for what you're trying to do. You can then use Object.keys to get the names of the format sizes, which can then be used to loop through your formats.
I've included a snippet below, which you'll probably want to change a little, for example to include your api url.
This uses the Props, Computed Properties, Template Syntax, List Rendering and Component Registration sections of the documentation, that might be useful.
Vue.component("post-image-formats", {
template: "<div><strong>Src Set Url</strong><br /> {{srcsetUrl}}</div>",
props: ["formats"],
computed: {
srcsetUrl() {
if (!this.formats)
return null;
let sizes = Object.keys(this.formats);
return sizes.map(size => `${this.formats[size].url} ${this.formats[size].width}w`).join(", ");
}
}
});
let posts = [{
"image": {
"formats": {
"thumbnail": {
"hash": "thumbnail_image",
"ext": ".png",
"mime": "image/png",
"width": 245,
"height": 138,
"size": 76.89,
"url": "/uploads/thumbnail_image.png"
},
"large": {
"hash": "large_image",
"ext": ".png",
"mime": "image/png",
"width": 1000,
"height": 563,
"size": 916.23,
"url": "/uploads/large_image.png"
},
"medium": {
"hash": "medium_image",
"ext": ".png",
"mime": "image/png",
"width": 750,
"height": 422,
"size": 562.28,
"url": "/uploads/medium_image.png"
},
"small": {
"hash": "small_image",
"ext": ".png",
"mime": "image/png",
"width": 500,
"height": 281,
"size": 275.16,
"url": "/uploads/small_image.png"
}
}
}
},
{
"image": {
"formats": {
"thumbnail": {
"hash": "thumbnail_image",
"ext": ".png",
"mime": "image/png",
"width": 245,
"height": 138,
"size": 76.89,
"url": "/uploads/thumbnail_image.png"
},
"large": {
"hash": "large_image",
"ext": ".png",
"mime": "image/png",
"width": 1000,
"height": 563,
"size": 916.23,
"url": "/uploads/large_image.png"
},
"medium": {
"hash": "medium_image",
"ext": ".png",
"mime": "image/png",
"width": 750,
"height": 422,
"size": 562.28,
"url": "/uploads/medium_image.png"
},
"small": {
"hash": "small_image",
"ext": ".png",
"mime": "image/png",
"width": 500,
"height": 281,
"size": 275.16,
"url": "/uploads/small_image.png"
}
}
}
}
];
new Vue({
el: "#app",
data: () => {
return {
posts: posts
};
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div>
<post-image-formats v-for="post in posts" :formats="post.image.formats"></post-image-formats>
</div>
</div>
Hi I have annotated multi object dataset and exported as tensorflow format in VoTT. however I have no clue how to use it with tensorflow api.
Vott produces json file for each annotated images as follows:
"asset": {
"format": "jpg",
"id": "0b1e1aac9a6f2cc4e51d95ef368dbfe7",
"name": "lemon160.jpg",
"path": "file:/Volumes/Solix/Datasets/limedata/imgs_raw/lemon160.jpg",
"size": {
"width": 1280,
"height": 720
},
"state": 2,
"type": 1
},
"regions": [
{
"id": "HWaHAokRV",
"type": "RECTANGLE",
"tags": [
"Expired Lime"
],
"boundingBox": {
"height": 362.8564453125,
"width": 510.81555834378923,
"left": 625.7465495608532,
"top": 355.5866350446429
},
"points": [
{
"x": 625.7465495608532,
"y": 355.5866350446429
},
{
"x": 1136.5621079046425,
"y": 355.5866350446429
},
{
"x": 1136.5621079046425,
"y": 718.4430803571429
},
{
"x": 625.7465495608532,
"y": 718.4430803571429
}
]
}
}
can somebody suggest me a way to convert these files to tfrecords?