470,591 Members | 1,458 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Upload and resize pictures with path in database

First I've must say Im completly new in php scripting

What I need to do is upload, resize pictures with path in database

Here is theory of it, and plan of doing it

Hope somebody can help me
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

Jul 17 '05 #1
1 3551
Dean wrote:
First I've must say Im completly new in php scripting
Welcome to PHP.
What I need to do is upload, resize pictures with path in database
Good project for learning PHP.
Here is theory of it, and plan of doing it

Hope somebody can help me
Read the manual for the function I tell you about.
Try to make it work ... if it doesn't post your code and somebody will
tell you what you're doing wrong (and maybe a better way to do it)
- check if folder with name "ID_of_user" exists http://www.php.net/is_dir
- if it exists than upload images to it, if it doesn't then create it and
upload images http://www.php.net/mkdir
http://www.php.net/move_uploaded_file
- 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 http://www.php.net/getimagesize
- copy (resized) images to same users folder with name "newimagename.jpg" imagecopyresized (maybe better imagecopyresampled)
- conect to database mysql_connect (or mssql_connect, pg_connect, ...)
- insert into database path of images (image1, image2, image3, image4,
image5, image6, image7) mysql_query
- Delete (image1, image2, image3, image4, image5, image6) unlink
- Display images (newimagename1, newimagename2_2, newimagename3_3,
newimagename4_4, newimagename5_5, newimagename6_6) <img src="newimagename1"> ...
with link to biger images (newimagename1, newimagename2, newimagename3,
newimagename4, newimagename5, newimagename6)

<a href="bigger_image"><img ...></a>

Happy Coding :-)

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by DH | last post: by
3 posts views Thread by R Reyes | last post: by
9 posts views Thread by Wayne Smith | last post: by
1 post views Thread by Valerie | last post: by
anfetienne
14 posts views Thread by anfetienne | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.