Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
LonelyBeard  
#1 Posted : Thursday, January 22, 2015 11:44:07 PM(UTC)
LonelyBeard

Rank: Newbie

Groups: Member
Joined: 1/22/2015(UTC)
Posts: 1

i found this topic in the forum, and one answer was to use sessions to achieve this.

i'm not sure what the OP's code was but in my case i'm using a form to upload the images to the server. so i have a link in the form that's viewed in a browser and when that link is clicked it opens the app and the user proceeds with the upload. it then redirects to the same upload page in the browser and from here i want to show the image the user uploaded. (i hope that made sense LOL)

i'm using php and javascript.

here's the basic form code for the upload page. i removed some details in the aurup:? line, but UPLOAD_URL and REDIRECT_URL are the same values:

Code:
<form id="upload_form" enctype="multipart/form-data" method="post" action="publish.php" onsubmit="return checkForm()">
	<h3>Choose Image To Upload</h3>
	<div id="upload-btn"><a class="btn btn-clear" id="mobileUpload" href="aurup:?uploadUrl=[UPLOAD_URL]&redirectUrl=[REDIRECT_URL]&maxImageCount=1&licenseKey=[LICENSE_KEY]&fields=aurCheck%3D1">Choose File</a></div>
	<input type="hidden" name="aurCheck" value="1" />

	<?php
	$fileCount = -1;
	if (isset($_SESSION['aurCheck'])){
		$fileCount = 9000;
	}
	echo $fileCount;
	?>
	<div class="step2">
		<h3>Crop To Your Desired Area</h3>
		
		<img id="preview" src="[THE_UPLOADED_IMAGE]" />

		<input id="fileupload" class="btn btn-green" type="submit" value="Upload" disabled="true" />
	</div>
</form>

thanks in advance! :)

EDIT: i figured i can pass parameters to the redirect URL, but it looks like only static variables can be passed successfully (ex: var_name=123).

so to add to my question above, how do i pass the parameters that come with aurigma? specifically the ones listed on your site here.

Edited by user Friday, January 23, 2015 1:37:00 AM(UTC)  | Reason: additional information

Andrew  
#2 Posted : Friday, February 6, 2015 3:08:21 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Hi there,

The most convenient way to create an Aurigma Up link is to use jQuery's $.param like this:

Code:
var aurup = {
  uploadUrl: host + "/post.ashx",
  imageMode: "mode=thumbnail,size=640,autorotate=true",
  returnUrl: window.location.href,
  redirectUrl: window.location.href,
  fields: 'Category=Unknown'
};
$('#aurup').html("<a class='btn btn-default' href='aurup:?"+$.param(aurup)+"' >Open Aurigma Up (mobile devices only)</a>");

Here is a complete code example how to use it to dynamically change values you pass to Aurigma Up.

Code:
<!DOCTYPE>
<html>
<head>
	<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
	<script>
		var aurup = {};
		var updateParams = function() {
			$('#aurup').html("<a class='btn btn-default' href='aurup:?"+$.param(aurup)+"' >Open Aurigma Up (mobile devices only)</a>");
			$('#params').html($.param(aurup));			
		}
		
		$().ready(function(){
			$('.category-item').click(function(){
				aurup.fields = 'Category=' + this.innerText;
				updateParams();
			});

			var http = location.protocol;
			var slashes = http.concat("//");
			var host = slashes.concat(window.location.hostname);

			
			aurup = {
				uploadUrl: host + "/post.ashx",
				imageMode: "mode=thumbnail,size=640,autorotate=true",
				returnUrl: window.location.href,
			   	redirectUrl: window.location.href,
				fields: 'Category=Unknown'
			};
			updateParams();
        });


	</script>
</head>
<body class="container">
	<div class="page-header">
		<h1>Aurigma Up Example</h1>
		<p class="lead">Demonstrates how to work with Aurigma Up params dynamically through JavaScript</p>
	</div>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h2 class="panel-title">Params</h2>
		</div>

		<div id="params" class="panel-body" style="font-family: Consolas, Lucida Console, monospace;">
			
		</div>
		<div class="panel-footer" role="group" aria-label="Aurigma Up management">
			<div class="btn-group" id="aurup">Open Aurigma Up (mobile devices only)</div>
			
			<div class="dropdown btn-group">
				<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
					Change Category
					<span class="caret"></span>
				</button>
				<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
					<li role="presentation"><a class="category-item" role="menuitem" tabindex="-1" href="#">Personal</a></li>
					<li role="presentation"><a class="category-item" role="menuitem" tabindex="-1" href="#">Business</a></li>
					<li role="presentation"><a class="category-item" role="menuitem" tabindex="-1" href="#">Family</a></li>
				</ul>
			</div>

		</div>
	</div>
</body>
</html>
Andrew  
#3 Posted : Friday, February 6, 2015 3:15:57 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Regarding your question:

Quote:
so to add to my question above, how do i pass the parameters that come with aurigma? specifically the ones listed on your site here.

Sorry, not quite understand what you mean. It works in the following way:

1. On your page you create a param string and put it to <a> element. You may do it statically (like in your example) or dynamically, using JavaScript, like in my example above.

2. When the user clicks the <a> link, it opens up the Aurigma Up app. Aurigma Up does not have any access to the browser and therefore it does not know anything about your page. The only data it receives is what you pass through the param string.

3. When the user selects files and clicks Upload button, the app sends a POST request with all the fields listed on the Server API page to the URL you specify in ActionUrl. You cannot have any access to the selected files from the page with Aurigma Up params. You can only receive them on the page specified in the Action URL.

If the question was "how to pass some data to Aurigma Up to send along with files dynamically", see the code example above. There I use the fields param to pass Category to the server. The user can change this value after the page is loaded.

Hope this makes sense.

Edited by user Friday, February 6, 2015 3:17:33 AM(UTC)  | Reason: Not specified

Andrew  
#4 Posted : Friday, February 6, 2015 3:56:03 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
I have re-read the topic title and I think I understood what you asked about.

If you need to view a page AFTER the upload is complete, you should do it on the PHP URL specified by RedirectUrl. This functionality is out of scope of Aurigma Up - you should either write it yourself or use some gallery application.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.