From 413642eae96c13d9514e2262f5226bc402a7fb8e Mon Sep 17 00:00:00 2001 From: Doug Patti Date: Fri, 20 Jul 2012 22:28:49 -0400 Subject: [PATCH] Add text box for direct link after upload --- application/controllers/upload.php | 9 +++++++-- css/style.css | 17 +++++++++++++---- js/upload.js | 7 ++++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/application/controllers/upload.php b/application/controllers/upload.php index 4732101..ce88e74 100644 --- a/application/controllers/upload.php +++ b/application/controllers/upload.php @@ -56,10 +56,15 @@ class Upload extends CI_Controller { $this->image_lib->initialize($config); $this->image_lib->resize(); - $message = array('type'=>'success','status'=>'Uploaded successfully', 'file'=>base_url($file_name)); + $message = array( + 'type' => 'success', + 'status' => 'Uploaded successfully', + 'file' => base_url($file_name), + 'direct' => base_url('uploads/' . $file_name . $upload['file_ext']), + ); } } echo json_encode($message); } -} \ No newline at end of file +} diff --git a/css/style.css b/css/style.css index 6572332..d83ce19 100644 --- a/css/style.css +++ b/css/style.css @@ -209,7 +209,7 @@ h1{ height: 12px; width: 100%; left: 0; - bottom: 30px; + bottom: 55px; box-shadow: 0 0 2px #000; } @@ -243,13 +243,22 @@ h1{ #dropbox .linkHolder { + padding-left: 20px; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGWSURBVBgZpcE/a1NhGMbh3/OeN56cKq2Dp6AoCOKmk4uCn8DNycEOIojilr2TaBfRzVnESQR3Bz+FFDoWA2IjtkRqmpyc97k9qYl/IQV7XSaJw4g0VlZfP0m13dwepPbuiH85fyhyWCx4/ubxjU6kkdxWHt69VC6XpZlFBAhwJgwJJHAmRKorbj94ewvoRBrbuykvT5R2/+lLTp05Tp45STmEJYJBMAjByILxYeM9jzr3GCczGpHGYAQhRM6fO8uFy1fJQoaUwCKYEcwwC4QQaGUBd36KTDmQ523axTGQmEcIEBORKQfG1ZDxcA/MkBxXwj1ggCQyS9TVAMmZiUxJ8Ln/kS+9PmOvcSW+jrao0mmMH5bzHfa+9UGBmciUBJ+2Fmh1h+yTQCXSkJkdCrpd8btIwwEJQnaEkOXMk7XaiF8CUxL/JdKQOwb0Ntc5SG9zHXQNd/ZFGsaEeLa2ChjzXQcqZiKNxSL0vR4unVwwMENMCATib0ZdV+QtE41I42geXt1Ze3dlMNZFdw6Ut6CIvKBhkjiM79Pyq1YUmtkKAAAAAElFTkSuQmCC); + background-position: left center; + background-repeat: no-repeat; position: absolute; left: 0; - bottom: 0; - width: 100%; + bottom: 25px; + width: 220px; } -#dropbox .linkHolder input { +#dropbox .linkHolder.direct { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADpSURBVCjPY/jPgB8y0EmBHXdWaeu7ef9rHuaY50jU3J33v/VdVqkdN1SBEZtP18T/L/7f/X/wf+O96kM3f9z9f+T/xP8+XUZsYAWGfsUfrr6L2Ob9J/X/pP+V/1P/e/+J2LbiYfEHQz+ICV1N3yen+3PZf977/9z/Q//X/rf/7M81Ob3pu1EXWIFuZvr7aSVBOx1/uf0PBEK3/46/gnZOK0l/r5sJVqCp6Xu99/2qt+v+T/9f+L8CSK77v+pt73vf65qaYAVqzPYGXvdTvmR/z/4ZHhfunP0p+3vKF6/79gZqzPQLSYoUAABKPQ+kpVV/igAAAABJRU5ErkJggg==); + bottom: 0; +} + +#dropbox input { width: 100%; } diff --git a/js/upload.js b/js/upload.js index 5e608f3..83144c7 100644 --- a/js/upload.js +++ b/js/upload.js @@ -16,12 +16,14 @@ $(function(){ alert('There was an error: ' + response.status); $.data(file).addClass('error'); $.data(file).find('.linkBox').remove(); + $.data(file).find('.directLinkBox').remove(); return false; } else { $.data(file).addClass('done'); $.data(file).find('.linkBox').val(response.file); - $.data(file).find('.linkBox').click(function() { + $.data(file).find('.directLinkBox').val(response.direct); + $.data(file).find('input').click(function() { this.focus(); this.select(); }); @@ -77,6 +79,9 @@ $(function(){ '
' + '' + '
' + + '
' + + '' + + '
' + '';