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!');
	        }
	    });
		
	});
   
});