Hi all.
I've got script that does following:
- Uploads image on server
- Resize that imege and store image in folder with name of Id of user
- Saves path in database
here is my script as atachment
If somebody could help me modify my script so I could be able to upload 6 images.
First image must be resized to W=308 and H=208, and others images sizes must be resized to w=150 and h=100.
From first image also should be made thumbail with size w=100 and h=67.
all paths of images should be saved in database and image upladed in folder with name of Id of user.you wrote that and you can't add loops in it to get your six images?No. I've found that script on some forum.
I'm beginer in php scriptingahh ok, that expalins it. had me worried there for a bit instead of me writing it all I want you to learn too. give it a try first on where things should go.
you will need to look into for() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/control-structures.for.php">http://www.php.net/manual/en/control-structures.for.php</a><!-- m -->) and array() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.array.php">http://www.php.net/manual/en/function.array.php</a><!-- m -->) and foreach() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/control-structures.foreach.php">http://www.php.net/manual/en/control-st ... oreach.php</a><!-- m -->) for the loop after you upload.
give it a try and if it fails or get stuck post here and I will help you though it.Thank you for helping me and having knowledge and pacience.ok
here I go.
here are 4 sizes of images:
- newimagename1_1 with size W=100 and H=67
- newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6 with size W=308, H=208
- newimagename1 size W=308, H=208
- newimagename2, newimagename3, newimagename4, newimagename5, newimagename6 size W=500 and H=375
Code should go in this order:
- check if folder with name "ID_of_user" exists
- if it exists than upload images to it, if it doesn't then create it and upload images
- array (image1, image2, image3, image4, image5, image6)
- foreach(array)
- if size of images are biger than W=500 and H=375 than resize them to W=500 and H=375m, if are not leave them as they are
- copy (resized) images to same users folder with name "newimagename.jpg"
- array (newimagename2, newimagename3, newimagename4, newimagename5, newimagename6)
- for (newimagename1)
- resize newimagename1 to W=308, H=208
- copy newimagename1 to same users folder with new name "newimagename1_1.jpg"
- resize "newimagename1_1.jpg" to W=100 and H=67
- foreach(array)
- resize array to W=150 and H=100 and copy them resized to same user folder with name
"newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6"
- conect to database
- insert into database path of images (image1, image2, image3, image4, image5, image6, image7)
values (newimagename1_1, newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6)
- Delete (image1, image2, image3, image4, image5, image6)
- Display images (newimagename1, newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6)
with link to biger images (newimagename1, newimagename2, newimagename3, newimagename4, newimagename5, newimagename6)
- Display image newimagename1_1
I know that it is complicated a litle bit, I've tryed to explain in best way I could.
Should (for(), array(), foreach()) look in some way like abowe?yeah that is pretty close. now that you have the theory can you write the code? you should be able to do the html part pretty easy, right?
start on the php part and if you get stuck we can help.
you don't have to delete the images. you would want to do all the work when they are in the tmp stage so there wil be nothing to delete.
with resizing images you will need to look into the function imagecreatfromjpeg() in the php manual and you want to use move_uploaded_file() as well after the resizing is done.Sorry for non replying for long time.
All scripts I had have gone. Had to change hard disk (the old one is broken). Now I have to go all over again, and my time is running out.
Now I have no time for learning how to write this script, and my only way out is to BEG if somebody can save me time and please write this script for uploading and resizing pictures, and save my skin. I would aprecheate it VERY MUCH. Please HELP MEnot sure where I got this but it looks like what you want. you have to modify it to fit what you need.
I will not write any code for you but I will help you. just take the .txt off the end.This is script I've posted before. Ok. i aprecheate your help.
When I upload pictures & resize them with this script, they all look like they are 16 bit pictures
Whythen refine your parameters. I never fooled with the script so I can't tell you. remember, you are resizing in a php script, it will never be perfect.I agree, but colours shouldn't disaperethat is true, so if you are missing colors check the functions and make sure you are using the right ones.
I've got script that does following:
- Uploads image on server
- Resize that imege and store image in folder with name of Id of user
- Saves path in database
here is my script as atachment
If somebody could help me modify my script so I could be able to upload 6 images.
First image must be resized to W=308 and H=208, and others images sizes must be resized to w=150 and h=100.
From first image also should be made thumbail with size w=100 and h=67.
all paths of images should be saved in database and image upladed in folder with name of Id of user.you wrote that and you can't add loops in it to get your six images?No. I've found that script on some forum.
I'm beginer in php scriptingahh ok, that expalins it. had me worried there for a bit instead of me writing it all I want you to learn too. give it a try first on where things should go.
you will need to look into for() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/control-structures.for.php">http://www.php.net/manual/en/control-structures.for.php</a><!-- m -->) and array() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.array.php">http://www.php.net/manual/en/function.array.php</a><!-- m -->) and foreach() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/control-structures.foreach.php">http://www.php.net/manual/en/control-st ... oreach.php</a><!-- m -->) for the loop after you upload.
give it a try and if it fails or get stuck post here and I will help you though it.Thank you for helping me and having knowledge and pacience.ok
here I go.
here are 4 sizes of images:
- newimagename1_1 with size W=100 and H=67
- newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6 with size W=308, H=208
- newimagename1 size W=308, H=208
- newimagename2, newimagename3, newimagename4, newimagename5, newimagename6 size W=500 and H=375
Code should go in this order:
- check if folder with name "ID_of_user" exists
- if it exists than upload images to it, if it doesn't then create it and upload images
- array (image1, image2, image3, image4, image5, image6)
- foreach(array)
- if size of images are biger than W=500 and H=375 than resize them to W=500 and H=375m, if are not leave them as they are
- copy (resized) images to same users folder with name "newimagename.jpg"
- array (newimagename2, newimagename3, newimagename4, newimagename5, newimagename6)
- for (newimagename1)
- resize newimagename1 to W=308, H=208
- copy newimagename1 to same users folder with new name "newimagename1_1.jpg"
- resize "newimagename1_1.jpg" to W=100 and H=67
- foreach(array)
- resize array to W=150 and H=100 and copy them resized to same user folder with name
"newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6"
- conect to database
- insert into database path of images (image1, image2, image3, image4, image5, image6, image7)
values (newimagename1_1, newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6)
- Delete (image1, image2, image3, image4, image5, image6)
- Display images (newimagename1, newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5, newimagename6_6)
with link to biger images (newimagename1, newimagename2, newimagename3, newimagename4, newimagename5, newimagename6)
- Display image newimagename1_1
I know that it is complicated a litle bit, I've tryed to explain in best way I could.
Should (for(), array(), foreach()) look in some way like abowe?yeah that is pretty close. now that you have the theory can you write the code? you should be able to do the html part pretty easy, right?
start on the php part and if you get stuck we can help.
you don't have to delete the images. you would want to do all the work when they are in the tmp stage so there wil be nothing to delete.
with resizing images you will need to look into the function imagecreatfromjpeg() in the php manual and you want to use move_uploaded_file() as well after the resizing is done.Sorry for non replying for long time.
All scripts I had have gone. Had to change hard disk (the old one is broken). Now I have to go all over again, and my time is running out.
Now I have no time for learning how to write this script, and my only way out is to BEG if somebody can save me time and please write this script for uploading and resizing pictures, and save my skin. I would aprecheate it VERY MUCH. Please HELP MEnot sure where I got this but it looks like what you want. you have to modify it to fit what you need.
I will not write any code for you but I will help you. just take the .txt off the end.This is script I've posted before. Ok. i aprecheate your help.
When I upload pictures & resize them with this script, they all look like they are 16 bit pictures
Whythen refine your parameters. I never fooled with the script so I can't tell you. remember, you are resizing in a php script, it will never be perfect.I agree, but colours shouldn't disaperethat is true, so if you are missing colors check the functions and make sure you are using the right ones.