--- Resume content start ---

Official website :http://www.uploadify.com/   A good upload plug-in . Official documents http://www.uploadify.com/documentation/

There's a lot of usage on the Internet . Happy today. I want to make a dynamic choice in the project , And then upload , At the same time, the server side , Received the address of the parameter and picture . But uploadify, Directly get , Page load value . So I searched . The way to find it . But it's all old versions . Today I'm going to write a new 3.21 edition .

The main points of     1、 Turn off auto upload . Red place

$('#upload').uploadify({
swf : '__PUBLIC__/uploadify/uploadify.swf',
uploader : '__APP__/Home/Word/upload',
width : 120,
height : 30,
auto: false,
fileTypeDesc : 'Image File',
fileTypeExts : '*.jpeg; *.jpg; *.png; *.gif',
formData : {'session_id' : sid },
onUploadSuccess : function (file, data, response)
{
alert(data);
} });

2、 Before using manual upload , Settings settings fromData     For example, in my project

<a class="btn btn-success" href="javascript:$('#upload').uploadify('settings', 'formData', {'type': $('.prov').val() , 'city': $('.city').val() });$('#upload').uploadify('upload')"> Start uploading 
</a>

I'm using php, With thinkphp The frame back-end processing image code is also pasted :

public function upload ()
{
if (!IS_POST) {
$this -> error(' The page doesn't exist ');
}
// p($_POST);die;
$upload = $this ->_upload(); } /**
* Processing image upload
*/
Private function _upload ()
{
$upload = new \Think\Upload();// Instantiate upload class
$upload->maxSize = 3145728 ;// Set attachment upload size
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');// Set attachment upload type
$upload->rootPath = './Uploads/'; // Set the attachment upload root
$upload->uploadRepace = true; // Overlay with the same name
$upload->thunb = true; // Do thumbnail processing
$upload->thunbMaxWidth =90;// Thumbnail width
$upload->thunbMaxHeight =60;// Thumbnail height
$upload->thunbPrefix ='mini_';// Thumbnail prefix
// $upload->savePath = ''; // Set up attachment upload ( Son ) Catalog
// Upload files
$info = $upload->upload();
if(!$info) {// Upload error message
return array('status' => 0, 'msg' => $this->error($upload->getError()) );
}else{// Upload successful
foreach($info as $file){
return $file['savepath'].$file['savename'];
}
$this->success(' Upload successful !');
}
}
} // Watermark the picture
function mark_pic
(
$background, $waterpic, $x, $y){
$back=imagecreatefromjpeg($background);
$water=imagecreatefromgif($waterpic);
$w_w=imagesx($water);
$w_h=imagesy($water);
imagecopy($back, $water, $x, $y, 0, 0, $w_w, $w_h);
imagejpeg($back,"__PUBLIC__/images/hee8.jpg");
imagedestroy($back);
imagedestroy($water);
}
// mark_pic("./images/hee.jpg", "./images/gaolf.gif", 50, 200);
// Picture with text watermark
function mark_text($background, $text, $x, $y)
{
$back=imagecreatefromjpeg($background);
$color=imagecolorallocate($back, 0, 255, 0);
imagettftext($back, 20, 0, $x, $y, $color, "simkai.ttf", $text);
imagejpeg($back, "./images/hee7.jpg");
imagedestroy($back);
}

Finally, I wrote a little demo It mainly describes the dynamic parameter transmission .demo Download address : Download address

 

uploadify The usage and dynamic parameter transfer of Provide demo Download more related articles

  1. uploadifive 1.1.2 Dynamic transfer parameters

    Used before Flash Version of uploadify, I wrote an article about uploadify The article of dynamic parameter transmission ( Click to open the link ). Then there was. HTML5 Version of the upload control , It's called uploadifive, It's been tested for a while , It's not bad . Here's the Lord ...

  2. uploadify 3.2 Background dynamic parameters

    I'm working on a little upload function recently , You need to pass some dynamic parameters to the background , There are some parameters on the Internet, which may be due to the wrong version . I've read some notes on the official website , done . 3.2 Passing parameters in is 'formData':{'somekey': ...

  3. python---- Dynamic parameter transfer of functions

    Dynamic parameter transfer of functions *args Aggregate the positional parameters of all arguments into a tuple , And assign this tuple to args Sometimes , For the function , The number of arguments passed in may not be fixed , It's dynamic , At this time, we need to use the function's dynamic parameter transfer . below ...

  4. stay Java Dynamic parameter transfer call in Python Script

    lately , Another wonderful interface , Based on the situation that the boss keeps pressing for time , In rewriting java Interface and reuse existing python The latter is chosen from the two paths of script , But the latter is not much better , Because I'm a right python The understanding of the concept is limited to its name ...

  5. Super full table function Datatables The journey to fill the pit --2:post Dynamic transfer parameters : solve : ajax There is no value problem in parameter transmission .

    Official website explanation and method :1  When sending a ajax request ,Datatables The data requested by the server will be constructed as a data object . 2 In fact, he was referring to jQuery Of ajax.data Attributes come from , He can add additional parameters to ...

  6. Android Use Gradle Command dynamic parameters to complete the packaging , No code changes required

    Have to say ,Gradle Very powerful , Someone will ask. Gradle What is it? ? I won't go into details here , In my opinion, he is an artifact of construction .Gradle Provides : One is like Ant The same very flexible generic build tool A switchable , image Maven ...

  7. python- Function advanced - Dynamic transfer parameters , The name space , Scope problem

    One . The dynamic parameters of a function There are two kinds of dynamic parameters : Dynamic receive position parameters . Dynamically receive key parameters . 1.*args  Dynamic transfer of position parameters # The order : Positional arguments =>*args(arguments) => Default ...

  8. python( Dynamic transfer parameters 、 Namespace 、 Nested function 、global and nonlocal keyword )

    One . Dynamic parameter transfer of functions 1.*args Dynamic transfer of position parameters def chi(*food): print(food) chi(" Barbecue "," Hot pot "," Shrimp eat shrimp rinse &q ...

  9. python- function - Dynamic transfer parameters , Scope problem , Nested function ,global nonlocal

    ⼀. Function parameter -- Dynamic transfer parameters We've talked before about Chuanshen , If we need to give ⼀ Two functions pass parameters , ⽽ Parameters ⼜ It's uncertain . Or I'll give ⼀ individual Functions pass a lot of arguments , I have to write a lot of formal parameters , very ⿇ Bother , What shall I do? . We can consider making ⽤ Dynamic parameter ...

Random recommendation

  1. How to calculate a specific InnoDB The index size of

    In general , We can use this command to look at the table information show table status: mysql> show table status like 't'\G . row ***************** ...

  2. Study django And python in os Function of module

    os.sep Instead of operating system specific path separators .windows for  “\\” os.name The string indicates the platform you are using . For example, for Windows, It is 'nt', And for Linux/Unix user , It is 'pos ...

  3. Android Handler Use example of : Combined with the understanding of source code Android Handler Mechanism ( One )

    What is? Handler? Android Official explanation : The document is divided into sections 1:A Handler allows you to send and process Message and Runnable objec ...

  4. Use session Plug in and implement login verification

    var express = require('express'); var cookieParser = require('cookie-parser'); var bodyParser = requ ...

  5. Ntop Monitoring network traffic

    Application Ntop Monitoring network traffic ____ Network traffic reflects the running state of the network , It is the key data to judge whether the network is running normally , In the actual network , If the network traffic is not well controlled or network congestion occurs , It will lead to the decrease of network throughput . Network performance degradation . adopt ...

  6. ssh: scp command

    scp Copy command Eg. -r /tmp/q1 root@[::]/home 1. Command format : scp [ Parameters ] [ The original path ] [ The target path ] 2. Command function : scp yes secure copy Abbreviation , sc ...

  7. Ubuntu Install desktop environment

    1. install Ubuntu default Gnome desktop : sudo apt-get install ubuntu-desktop 2. Do not install default components , for example Evolution and OpenOffice: sudo apt ...

  8. 201521123077 《Java Programming 》 The first 8 Weekly learning summary

    1. This week's learning summary 1.1 In the way you like ( Mind mapping or something ) Summarize the related contents of set and generics . Generic classes Using generics, you can write a more general class , Take the following example : class simpleHolder<T&g ...

  9. Django And URL( Routing system ) usage

    Routing system The concept of routing system In short , Routing system is a corresponding relationship between path and view function .django The function of our routing system is to make views Functions that process data and requested url Establish a mapping relationship . After the request comes , according to urls.py in ...

  10. About HTML When the element clicks , Background color in seconds , The way to exit slowly

    I don't say much nonsense , Code up <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...