Thank you for the reply - Though I’m a little confused about this thread.
In your previous posting, you mentioned that:
API user doesn’t allow to create Icon
Meaning that I would need to use a HumanUser
connection credential.
Though:
I don’t what data you used for sourceIcon['image_data']
. If it is a image path like sg.create(‘Icon’, {‘name’: ‘new_icon_name’, ‘image_data’: ‘a.jpg’}) , after you run the script, shotgun site would be crashed.
The correct way to use this api is
sg.create('Icon', {'name': 'New Icon 99', 'icon_type': 'custom_status', 'display_type': 'image', 'image_data': '<hex_encoded_16px_wide_jpg>'})
.
That suggests to me that I would need to pre-convert the image I wanted to use:
C:/path/to/icon.png
to a hex-encoded 16px wide jpg and use data similar to what I’ve found in other icons:
{'cached_display_name': 'New Icon 98',
'display_type': 'image',
'html': None,
'icon_type': 'custom_status',
'id': 98,
'image_data': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGP\nC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUw\nAADqYAAAOpgAABdvkl/FRgAAAUFQTFRF////4eHh19fXwsLCvb29y8vL7e3t\nnp6esrKy8/PzycnJ0NDQu7u7v7+/8vLy+/v6urq6xsbG8vHz1dXVzc3Menp6\nkJCQlZaVl5eXk5OTlZWVpKSkpqamqKio2dnZxcXFxMTE39/f4uLk1tbX09PT\n+Pj48PDwzs7P0tLT3Nzc8fHx5ubn0dHR09PSgYGBLCwsRUVFhISEvLy8YWFh\nTU1Ng4ODZGRkCwsLvLy80dHRJiYmT09PhISEoqKidXV1iYmJAwMDAgICUVFR\nQkJCTExMNzc3EBAQFRUVHh4eyMjIFhYWw8PDw8PDsbGxGRkZISEigoGFu7u7\nubm5BAQEMTExXl5eEBAQgICAICAgZ2dnnZ2dEBAR4eHjoKCgDg4OIiIix8fI\nyMjHfX19Ozs8Ozs7gICB1tbWAAAAAQEBAwME////uIU6FAAAAGd0Uk5TAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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4eyMjIFhYWw8PDw8PDsbGxGRkZISEigoGFu7u7\nubm5BAQEMTExXl5eEBAQgICAICAgZ2dnnZ2dEBAR4eHjoKCgDg4OIiIix8fI\nyMjHfX19Ozs8Ozs7gICB1tbWAAAAAQEBAwME////uIU6FAAAAGd0Uk5TAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEiT\nhRcEYm8zkOoYGNh+YlByWdj+r5SMv8e5wRrjOQNE6N2NLwT6wE3oI9eWN/kR\nTPPrLA90pad2ClEPq+gAAAABYktHRACIBR1IAAAACXBIWXMAAAsTAAALEwEA\nmpwYAAAAsklEQVQY02NgQAeMTHr6BobMLKxsRsYmpuwcDJxm6enp5hbMXJZW\nQIY1N4NNOgjY8vDagRn2DA4gytHJ2cUVLODG4A6iMtJhwIPB0ysdCWR6M/D5\n+PrBuP4BgfwMAoJBwTCBECFhEQZRsVC4hjBxCUkGKelwuIAVIzcrg4wsSwRM\nIJJBTo5BXkExCsqPjlFSVmZQUeFWjY0D8eMT1NQ1NBg0gUArMSk5JTVNW0dX\nRQXD9wAArUB1Md3OWgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wMS0xNVQx\nOToxMTo0NCswMDowMF8+S4sAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDEt\nMTVUMTk6MTE6NDQrMDA6MDAuY/M3AAAAAElFTkSuQmCC\n',
'uuid': '58737146-9cea-11e4-9405-00259000f98e'}
I’m aware of the batch API commands, though what I was asking about was the ability (in the web UI) to select multiple images to upload.
Now… (shifting gears) - based on this latest example you provided, it would seem I could use a filepath to a .png
image for the image_data
field?
I haven’t been able to find any documentation for uploading images to the Icon
entity.
TL;DR
@jing.liu - Can I use 'image_data' : 'C:/path/to/icon.png'
as a valid argument through a HumanUser
shotgun connection to create these Icon
Entities?
I hope you understand the need for clarity - The last thing I want to do is crash our shotgun server.