Hi, basically what i have got is a upload form that im linking to a flash gallery. The gallery uses two versions of an image....1 is for the thumbnail and the other the actual image. When i upload the images I am able to copy the files into a temp folder.
What id like to do now is resize the images, rename them and then move them back to the original folder.....can someone tell me where i can get started with this?
thanks in advance
4 2116
The GD image manipulation tools are really useful for this stuff!
im a noob with php....i dont understand a thing about libraries yet lol....could you suggest something just using php? i can understand it once i see it and do what i need need to get it to do but i dont know anything about the structures and variables best to do so
To use image manipulation functions, you're going to need one of the libraries (GD or ImageMagick.. I'm sure there are others too).
To copy (and rename a file) have a look at Copy().
i have already got the files to copy from the original folder to a temp folder...then renamed them as i need them i.e.
1b.jpg
2b.jpg
3b.jpg etc
its just copying them back thats the problem
this is my code for the whole file that im working on: -
<!doctype html public "-//w3c//dtd html 3.2//en">
-
<html>
-
<head>
-
<title>Multiple image upload script from plus2net.com</title>
-
</head>
-
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
-
<?
-
-
$random_digit = $_POST['ID'];
-
$returnURL = $_POST['returnURL'];
-
-
$imgtemp=mkdir("upload/imgtemp/$random_digit", 0777);
-
-
-
?>
-
-
-
-
<?
-
while(list($key,$value) = each($_FILES['images']['name']))
-
{
-
if(!empty($value))
-
{
-
$filename = $value;
-
$filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line
-
-
$add = "upload/$random_digit/$filename";
-
$tempFLDR = "upload/imgtemp/$random_digit/$filename";
-
//echo $_FILES['images']['type'][$key];
-
// echo "<br>";
-
copy($_FILES['images']['tmp_name'][$key], $add);
-
chmod("$add",0777);
-
copy($_FILES['images']['tmp_name'][$key], $tempFLDR);
-
chmod("$tempFLDR",0777);
-
-
$folderPath="upload/$random_digit/";
-
}
-
}
-
?>
-
-
<?
-
//fill in details about the path
-
$path="upload/$random_digit/";
-
-
//variable used for the name of each file
-
$i=1;
-
-
$od = opendir($path);
-
while (false !== ($filename = readdir($od)))
-
{
-
//you can add any type of filenames you wish to skip (for instance Thumbs.db on windows)
-
if($filename != '.' && $filename != '..' && !is_dir($path.$filename))
-
{
-
//we give files a name - here we use increasing numbers for jpg files:
-
if(rename($path.$filename, $path.$i++.'.jpg'))
-
echo 'Renamed file '.$filename.'<br />';
-
}
-
}
-
-
closedir($od);
-
-
?>
-
-
<?
-
//fill in details about the path
-
$pathT="upload/imgtemp/$random_digit/";
-
-
//variable used for the name of each file
-
$i=1;
-
-
$odT = opendir($pathT);
-
while (false !== ($filename = readdir($odT)))
-
{
-
//you can add any type of filenames you wish to skip (for instance Thumbs.db on windows)
-
if($filename != '.' && $filename != '..' && !is_dir($pathT.$filename))
-
{
-
//we give files a name - here we use increasing numbers for jpg files:
-
if(rename($pathT.$filename, $pathT.$i++.'b.jpg'))
-
echo 'Renamed file '.$filename.'<br />';
-
}
-
}
-
closedir($odT);
-
?>
-
-
<?
-
copy($tempFLDR, $path) or die ;
-
?>
-
<?
-
$username="vecre0_tempU";
-
$password="auction";
-
$database="vecre0_templates";
-
-
-
// OPEN CONNECTION --->
-
$connection=mysql_connect("localhost","$username", "$password") or die("Unable to connect!");
-
-
mysql_select_db("$database") or die("Unable to select database!");
-
-
-
// EXECUTE QUERY --->
-
$query="INSERT INTO paths (
-
-
folderPath)
-
-
VALUES(
-
'".$folderPath."')";
-
//////----->
-
$result=mysql_query($query) or die("Error in query:".mysql_error());
-
//if ($result)
-
//echo mysql_affected_rows()." row inserted into the database effectively.";
-
-
// CLOSE CONNECTION --->
-
mysql_close($connection);
-
?>
-
-
-
-
-
-
-
</body>
-
-
</html>
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sarah |
last post by:
Hi,
Can someone please tell me if there's a way to copy image files from
one server to another using ASP and FSO? Or perhaps some other way
to do it?
I'm trying to collect information on...
|
by: Matt |
last post by:
When browsing a web page a user has the ability to highlight content on
a page (by holding down the left mouse button and dragging the mouse
over the desired content). Is there a way to disable...
|
by: Kirk |
last post by:
I have created an application that copies images I select to two
printer que's. The images are either AutoCAD plot files (.PLT) or
scanned images (.TIF). My method works well for the PLT files on...
|
by: Daves |
last post by:
why the heck can't I use Directory.Move() to rename a directory (containing
files) to a entry 2 levels below e.g.
uploads/tempfiles
-> uploads/tempfiles/48/003files
if I do this in one line...
|
by: mantrid |
last post by:
Hello
Is there a way to prevent users copying a full size image from a web page.
Displaying the image with a smaller width and height only affects the image
as viewed, the actual full size image...
|
by: Neil |
last post by:
I have a form that has its own custom menu bar in Access 2000. I'd like to
make a copy of the menu bar and use it with another form. How can I do this?
Thanks.
|
by: rush81 |
last post by:
i'm trying to create an ssis package for renaming and moving the file. It gives error at the file system task:
Error: An error occurred with the following error message: "Could not find file...
|
by: chazzy69 |
last post by:
This is a little hard to explain but i will try to make it as clear as possible.
Firstly here's the setup, 2 databases on 2 different servers (databases are identical) now within the first...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |