Multiple upload and Resize
Posted on
16th Feb 2014 07:03 pm by
admin
I would like some help on my script I have the for my index.php
////
<html>
<head>
<!-- Include the javascript -->
<script src="multifile_compressed.js"></script>
</head>
<body>
<!-- This is the form -->
<form enctype="multipart/form-data" action="upload.php" method = "post">
<!-- The file element -- NOTE: it has an ID -->
<input id="my_file_element" type="file" name="file_1" >
<input type="submit">
</form>
Files:
<!-- This is where the output will appear -->
<div id="files_list"></div>
<script>
<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 3 );
<!-- Pass in the file element -->
multi_selector.addElement( document.getElementById( 'my_file_element' ) );
</script>
</body>
</html>
//////
For my upload.php
but this script is for only one image
///
<?php
if(isset($_POST['submitimg'])){
if (isset ($_FILES['new_image'])){
$imagename = $_FILES['new_image']['name'];
$source = $_FILES['new_image']['tmp_name'];
$target = "../Dphotos/".$imagename;
move_uploaded_file($source, $target);
$imagepath = $imagename;
$save = "../Dphotos/" . $imagepath; //This is the new file you saving
$file = "../Dphotos/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modheight = 350;
$diff = $height / $modheight;
$modwidth = $width / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
$save = "../Dphotos/thumbs/" . $imagepath; //This is the new file you saving
$file = "../Dphotos/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modheight = 100;
$diff = $height / $modheight;
$modwidth = $width / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0,$modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
echo "Large image: <img src='../Dphotos/".$imagepath."'>
";
echo "Thumbnail: <img src='../Dphotos/thumbs/".$imagepath."'>";
}
}
?>
/////
Please help thanks
No comments posted yet
Your Answer:
Login to answer
93
35
Other forums
Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.
for example if i give a direct lin
Problem Dereferencing
With these types and tables:
CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,
Extracting Long text from message class with parameters
Hi,
I would like to extract the long text from a message class. However, the long text ha
Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so
Is it a good practice to store user info. in sessions?
I am making a user class for my script which stores all the user information in sessions. It takes u
Curl & sessions PLS HELP
Hello,
I have a problem with curl and sessions and i will try to explain the best i could.
PHP page is blank
Hi Everyone,
I have a site in which I am able to open the first PHP webpage in my browser but
Having Problem with Date
l have a submit buttom where user have the possibility to add a date to specify when his message s
default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?
login form can you find my error?
registrationform.php seems fine send data to registration.php
registration.php seems fine checks