Saving the product image with PHP

Modified on Mon, 19 Dec 2022 at 03:42 PM

You find a PHP script in the source folder, which will save an image on your webserver. You only need to send the data url of your product to this script, which will create an image from it.       

//send data url to php script when clicking on a custom element
$('#save-image-php').click(function() {
	thsirtDesigner.getProductDataURL(function(dataURL) {
		
		$.post("php/save_image.php", { base64_image:  dataURL}, function(data) {
	        if(data) {
	            //window.open(data, '_blank');
	        }
	        else {
	            //do what you want here, e.g. alert('Image Generation failed!');
	        }
	    });
		
	});
   
});	

     

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article