> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: createGalleryItem(galleryId: string, item: Item, options: CreateGalleryItemOptions) # Method package: wixProGalleryBackend # Method menu location: wixProGalleryBackend --> proGallery --> createGalleryItem # Method Link: https://dev.wix.com/docs/velo/apis/wix-pro-gallery-backend/pro-gallery/create-gallery-item.md # Method Description: Creates a media item in a specified gallery. The `createGalleryItem()` function returns a Promise that resolves to a newly-created gallery item after it has successfully been created.
__Important:__ When creating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.# Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create a gallery item ```javascript import { proGallery } from 'wix-pro-gallery-backend'; /* Sample galleryId value: 'af5c3670-9b0f-4d86-b3b9-19fe62006c39' * * Sample item value: * { * "description": "New image item", * "title": "My first gallery item", * "tags": { * "values": ["ball","sea","beach"] * }, * "image": { * "type": "WIX_MEDIA", * "imageInfo": "wix:image://v1/9e6ea4_650d8cd45f7545c4b39178feb0ee8c70~mv2.jpg/300.jpg#originWidth=200&originHeight=300" * }, * "link": { * "text": 'Click here for more info.', * "url": 'https://www.wix.com/about/us' * } * }; */ export async function myCreateGalleryItemFunction(galleryId, item) { try { const createdGalleryItem = await proGallery.createGalleryItem(galleryId, item); const id = createdGalleryItem._id; const title = createdGalleryItem.title; console.log('Success! Created the gallery item:', createdGalleryItem); return createdGalleryItem; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_createdDate": "Mon Feb 08 2021 13:44:37", * "_id": "10874ccf-5867-4225-9550-3885079bad66", * "_updatedDate": Mon Feb 08 2021 13:44:37, * "description": "This is the first item in my gallery.", * "image": { * "imageInfo": "wix:image://v1/38939f9568z222d6avc6285c9ac1e9129.jpg/38939f9568z222d6avc6285c9ac1e9129.jpg#originWidth=200&originHeight=199" * }, * "link": { * "text": 'Click here for more info.', * "url": 'https://www.wix.com/about/us' * }, * "sortOrder": 1657439075188, * "tags": { * "values": ["ball","sea","beach"] * }, * "title": "My first gallery item", * "type": "IMAGE" * } */ ``` ---