Ultradox: insert image from Google Drive

358 views
Skip to first unread message

Jason Pettys

unread,
Jan 24, 2013, 12:58:32 PM1/24/13
to flore...@googlegroups.com
I'm enjoying Ultradox a lot; it's fitting in well with our goals and aims.
 
I saw that images can be added by URL; is there an easy way to reference an image I have stored on the same Google Drive account that is hosting the Ultradox templates?
 
I'm trying to figure out how to tell Google to just give me a raw URL straight to the image, but I'm not seeing a way to do that.
 
Jason

Daniel Florey

unread,
Jan 24, 2013, 1:07:17 PM1/24/13
to floreysoft GmbH
Hi,
I've not tried that (yet), but it sounds like a good feature request.
I'll put that on our roadmap.

Right now you may have to do it like described here (quite complicated...):

Thanks,.
Daniel


2013/1/24 Jason Pettys <jpe...@gmail.com>
 
Jason

--
You received this message because you are subscribed to the Google Groups "floreysoft" group.
To post to this group, send email to flore...@googlegroups.com.
To unsubscribe from this group, send email to floreysoft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/floreysoft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jason Pettys

unread,
Jan 24, 2013, 1:08:19 PM1/24/13
to flore...@googlegroups.com
I was able to use this technique to do it:
 
But one drawback is that I have to publicly share the containing folder - would like a way to do this without doing that.
 
Jason

Daniel Florey

unread,
Jan 24, 2013, 1:09:55 PM1/24/13
to floreysoft GmbH
Yes, that requies real Ultradox-Integration like embedding Spreadsheet data.


2013/1/24 Jason Pettys <jpe...@gmail.com>
 
Jason

--

Atmaja Anand

unread,
Dec 19, 2014, 4:55:53 AM12/19/14
to flore...@googlegroups.com
here is a script which might help:
- uploads a graphic file to a google drive folder
- formats the URL so that it can be read by Ultradox image placeholder as an image
- adds the URL to your spreadsheet (at the position where you clicked with the mouse)

To get started you need to change in this script:
- Folder ID in the lower part of the script


// upload document into google spreadsheet
// and put link to it into current cell

    function onOpen(e) {
      var ss = SpreadsheetApp.getActiveSpreadsheet()
      var menuEntries = [];
      menuEntries.push({name: "File...", functionName: "doGet"});
      ss.addMenu("Upload Attachment", menuEntries);
    }

    function doGet(e) {
      var app = UiApp.createApplication().setTitle("upload attachment into Google Drive");
      SpreadsheetApp.getActiveSpreadsheet().show(app);
      var form = app.createFormPanel().setId('frm').setEncoding('multipart/form-data');
      var formContent = app.createVerticalPanel();
      form.add(formContent);  
      formContent.add(app.createFileUpload().setName('thefile'));

      // these parameters need to be passed by form
      // in doPost() these cannot be found out anymore
      formContent.add(app.createHidden("activeCell", SpreadsheetApp.getActiveRange().getA1Notation()));
      formContent.add(app.createHidden("activeSheet", SpreadsheetApp.getActiveSheet().getName()));
      formContent.add(app.createHidden("activeSpreadsheet", SpreadsheetApp.getActiveSpreadsheet().getId()));
      formContent.add(app.createSubmitButton('Submit'));
      app.add(form);
      SpreadsheetApp.getActiveSpreadsheet().show(app);
      return app;
    }

function doPost(e) {
      var app = UiApp.getActiveApplication();
      app.createLabel('saving...');
      var fileBlob = e.parameter.thefile;

     // change folder ID in the row below!

      var doc = DocsList.getFolderById('0BymsUm2dkZGMFU').createFile(fileBlob);
      var label = app.createLabel('file uploaded successfully');

      // write value into current cell

      var value = 'https://drive.google.com/uc?id=' + doc.getId();
      var valuecomment = doc.getName();



      var activeSpreadsheet = e.parameter.activeSpreadsheet;
      var activeSheet = e.parameter.activeSheet;
      var activeCell = e.parameter.activeCell;
      var label = app.createLabel('file uploaded successfully');
      app.add(label);
      SpreadsheetApp.openById(activeSpreadsheet).getSheetByName(activeSheet).getRange(activeCell).setValue(value).setComment(valuecomment);
      app.close();
      return app;
    }

Reply all
Reply to author
Forward
0 new messages