summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.SurveyHeatMapSaveImage.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/classes/class.SurveyHeatMapSaveImage.php')
-rw-r--r--admin/survey/classes/class.SurveyHeatMapSaveImage.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/admin/survey/classes/class.SurveyHeatMapSaveImage.php b/admin/survey/classes/class.SurveyHeatMapSaveImage.php
new file mode 100644
index 0000000..9556880
--- /dev/null
+++ b/admin/survey/classes/class.SurveyHeatMapSaveImage.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Januar 2017
+ *
+ * Shrani heatmap porocilo v obliki slike
+ *
+ * @author Patrik Pucer
+ */
+class SurveyHeatMapImageSave
+{
+
+ function __construct() {
+ }
+
+ function ajax() {
+
+ global $site_url;
+ global $site_path;
+
+ if(isset($_POST['sprid'])) {
+ $sprid = $_POST['sprid'];
+ $heatmapId = 'heatmap'.$sprid;
+ $img = $_POST['image'];
+
+ define('UPLOAD_DIR', $site_path.'main/survey/uploads/');
+
+ $img = str_replace('data:image/png;base64,', '', $img);
+ $img = str_replace(' ', '+', $img);
+ $data = base64_decode($img);
+ $file = UPLOAD_DIR . $heatmapId . '.png';
+ $success = file_put_contents($file, $data);
+ print $success ? $file : 'Unable to save the file.';
+ }
+ //exit();
+ }
+} \ No newline at end of file