How to update Bigcommerce product image to image stored locally? - bigcommerce

Why I can't update image this way?
Bigcommerce::createProductImage($product_id, array('image_file'=>'/home/user/bigcommerce/api/picture.jpg'));
The follow code works:
Bigcommerce::createProductImage($product_id, array('image_file'=>'https://cdn6.bigcommerce.com/s-0cvdh/products/32/images/299/apitec71q__46081.1484240387.1280.1280__30161.1484331218.1280.1280.jpg'));

According to the documentation, it is not possible to upload an image locally. The docs say:
When specifying a product image, the image_file should be specified as either:
a path to an image already uploaded via FTP to the import directory (with the path
relative to the import directory); or a URL to an image accessible on the internet.

It doesn't work because the BigCommerce servers have no idea where "/home/user/bigcommerce/api/picture.jpg" lives. That's a file that exists on your local machine, and you're passing a string to BigCommerce telling it where to get the file. It works in the second case because BigCommerce can access that URI.
In more general terms, you need to upload the image to a location that BigCommerce can access it, and then pass a URI that BigCommerce can use to retrieve the image. It may seem a little cumbersome, but it relieves BigCommerce from having to stream large amounts of data through their API.

Related

Adding Photo to vCard

I'm trying to create a vCard containing the text below:
BEGIN:VCARD
VERSION:3.0
PHOTO;VALUE=uri:https://upload.wikimedia.org/wikipedia/commons/2/25/Intel_logo_%282006-2020%29.jpg
N:Raven;Test;;;
END:VCARD
according to this documentation (
screenshot of the part I'm talking about ) I tried base64 and it's working fine ( Contact app loads the image ) but in the URI situation it's not working ( Contact app does not load the image ),
To avoid making a large file, my goal is to have a url in my vCard.vcf file not a base64, I'm stuck understanding what's wrong with my vCard.
basically what I'm trying to make is a vCard containing a photo that gets fetched by the url given and shows the photo in contact app of whatever OS the user will open it on (Windows/Android/IOS/macOS).
I'm not using base64 because it makes my vCard file so big.
External urls are probably blocked by most programs, same as loading external images are blocked. It's a massive privacy concern.
Maybe hosting it on a service like Google Cloud would help, in that you can edit the CONTENT-TYPE and CACHE meta data attributes? It’s my novice understanding that smartphone OS is particularly wary of “unknown” file properties - probably for good reason.

How to upload images to AWS S3 with Ckeditor5

I am trying to upload an image to s3 bucket from CkEditor5. My front-end is built on vue and backend is on NodeJs. The uploading of images is working as expected as i can see the image is being saved to s3 bucket correctly. However I am having a confusion whether the bucket should be public or not ?
How CkEditor behaves to image uploading?
The ckEditor uses a simple upload adapter which uses its own built-in adapater that enables image uploading feature. When an images is dropped/copy-pasted to the ckEditor, it makes an http POST request to my backend NodeJs server and server in turns makes a call to S3 to upload that image(till this point everything is working as expected).
Now in order to embed an image inside CkEditor5, the server should respond with an URL attribute as JSON response like following so that CkEditor can fetch it and display inside editor.
{
url: url-path-of-image //full path of image in s3 bucket
}
This is where I am confused and need some pointers.
Question 1:
Should I make it public ? If yes, then what do I do about security, making it public will give access to anybody.
If I make it accessible with key/secret, how do I do it ?
Question 2:
This one is related to question#1
If I make it public then question#2 will not be an issue.However if I am not allowed to make it public in that case how would i display the images in normal div element ? Later on I need to display the content of CkEditor inside a div, with html parsing meaning inside a v-html attribute.
Any suggestions or pointers would be much helpful. Really appreciate taking time to read through the question.
I am not sure I am looking for the solutions. I can tell that it is related to signed urls in AWS S3. You keep bucket private, upload image to S3 and generate a signed url whenever you need to display the image to user on frontend.
If you learn more into the correct implementation please let me know.

Maintain Product Image URL in Moqui

Our product-specific images are at CDN and we want to store the image URL.
I found that we can do it in ProductContent with image type [PcntImageUrlOriginal]. Do we have an existing service?
You can use the inbuilt crud service:
create#mantle.product.ProductContent and set the contentLocation to a url I guess
The following is not an option as it receives the contents of the file as well as the extension but down below uses the inbuilt crud service.
mantle.product.ProductServices.create#ProductContent
declared in mantle-usl/service/mantle/product/ProductServices.xml

Exporting a list of images from Google Photos or DropBox as CSV

Do any of the major online photo storage/sharing platforms offer a reasonable way to export a set of image URLs and titles as something like a CSV or fetch them as JSON from a REST API?
I am trying to get any sort of clean list of title, url value pairs for all the images in a particular folder or gallery.
Google Drive/Photos would be my prefered platform, but I would switch to DropBox or other service if I could easily get such an export list.
If you're going to use Google Drive, you'll probably end up using these properties from File Resource:
webViewLink - a link for opening the file in a relevant Google editor
or
webContentLink - a link for downloading the content of the file in a
browser.
You can fetch this properties using files.list or files.get.
For Dropbox, you would use the /2/files/list_folder[/continue] endpoints to list the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
Then, you can use /2/sharing/create_shared_link_with_settings to create shared links for the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
Or, to retrieve existing shared links, use /2/sharing/list_shared_links:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
Those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.

Does AzureReader2 pull the image from the cdn if a query string is attached?

I think I need some explanation on this. On this page:http://stage.bullydog.com/Products/unfiltered-product/bd/BDGTPD/bully-dog-gt-platinum-diesel, you will see the following images:
The 2 on the left don't have any query strings and are located at:
http://stage.bullydog.com/azure/bdgtpd/40420_1.png and http://stage.bullydog.com/azure/bdgtpd/40420_4.png
On the third image, I put a query string of ?w=500 and that is located at:
http://stage.bullydog.com/azure/bdgtpd/40420_5.png?w=500
Her is a capture of the network traffic when I requested the page that contained the images:
Here is where I need some clarification and overall what is happening here:
If the image url contains a query string, does it pull the image from the azure cdn? I noticed the image 40420_5.png?w=500 has a Request Url of http://stage.bullydog.com/azure/bdgtpd/40420_5.png?w=500, so it doesn't appear to be pulling from the azure cdn. Why is this?
For the other images, take 40420_4 for example, I noticed it issues a 302 first and then another request. Why does it do this?
If using srcset, is ImageResizer beneficial here, for example, is it better to set the different sources with the query string attached, such as 40420_5.png?w=250, 40420_5.png?w=500, etc or is it better to just create the different image sizes such as 40420_5_w250.png, 40420_5_w500.png? or maybe Slimmage with SlimResponse would be the way to go?
AzureReader2 will issue a redirect to Azure if processing isn't required. Otherwise, your browser will not be able to see that AzureReader2 is making an HTTP request in the background to fetch the source resource. Your URLs should always point to the ImageResizer server.
Srcset + ImageResizer is great. Most people use it with the w=[value] and zoom=[value] querystring commands.