473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 3707
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: NotGiven | last post by:
Please help me understand the big picture of allowing users to upload pictures and keep them separate and tied to their record in the database. I want the whole thing automated and I'm just...
4
by: DH | last post by:
I have a "file upload form" that works OK, but I have been unsuccessful in my attempt to also resize the uploaded .JPG (if it is too wide), over-writing the original .JPG, and then create and save...
3
by: R Reyes | last post by:
what are the pros/cons of uploading a file into a database (like access, sql server, oracle) vs. uploading a file into a folder (and only storing its path in a database table) ? i've never had...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
0
by: dann2 | last post by:
hello, i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this: ... '<% ' Create an instance of AspUpload object 'Set...
1
by: Valerie | last post by:
Hello everyone, I am new in PHP-programming but I am learning the basics of it. I've got a script that uploads a picture together with all data from the inputform, to the server and places the...
7
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
14
anfetienne
by: anfetienne | last post by:
Hi, i went through a tutorial on how to display images stored with a directory and it came out good but i have a problem.....when i upload less than 5 files it displays the 1 image and then shows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.