Skip to content

Instantly share code, notes, and snippets.

class OrderAssetsZipDownloadCreator
def self.build(order_id, force = false)
@order = Order.find(order_id)
@force = force
unless @order.download_zip_url.present? #prevent duplicate images from being added to zip.
reupload_assets_with_tag
#create_zip
end
# Cloudinary credentials:
Set Variable [ $cloud_name; Value:"mycloudname" ]
Set Variable [ $api_key; Value:1234567890 ]
Set Variable [ $api_secret; Value:"abcdabcdabcdabcd" ]
# Validate presence of a file in "File Container"
If [ IsEmpty ( GetField ( "File Container" ) ) ]
Show Custom Dialog [ Title: "Error"; Message: "No image to upload"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”,
Commit: “No” ]
Exit Script [ Result: "No image to upload" ]
@taragano
taragano / cloudinary-php-pure_javascript.php
Last active August 1, 2019 06:49
Client side signed uploads with pure Javascript and PHP
<html>
<body>
<h1>Upload to Cloudinary with FormData</h1>
<form action="" method="post" enctype="multipart/form-data" onsubmit="AJAXSubmit(this); return false;">
<fieldset>
<legend>Upload example</legend>
<p>
<label >Select your photo:
<input type="file" name="file"></label>
</p>