Upload and resize pictures with path in database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dean

    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.j pg"

    - 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



  • Pedro Graca

    #2
    Re: Upload and resize pictures with path in database

    Dean wrote:[color=blue]
    > First I've must say Im completly new in php scripting[/color]

    Welcome to PHP.
    [color=blue]
    > What I need to do is upload, resize pictures with path in database[/color]

    Good project for learning PHP.
    [color=blue]
    > Here is theory of it, and plan of doing it
    >
    > Hope somebody can help me[/color]

    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)
    [color=blue]
    > - check if folder with name "ID_of_user " exists[/color]
    Tells whether the filename is a directory

    [color=blue]
    > - if it exists than upload images to it, if it doesn't then create it and
    > upload images[/color]


    [color=blue]
    > - 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[/color]

    [color=blue]
    > - copy (resized) images to same users folder with name "newimagename.j pg"[/color]
    imagecopyresize d (maybe better imagecopyresamp led)
    [color=blue]
    > - conect to database[/color]
    mysql_connect (or mssql_connect, pg_connect, ...)
    [color=blue]
    > - insert into database path of images (image1, image2, image3, image4,
    > image5, image6, image7)[/color]
    mysql_query
    [color=blue]
    > - Delete (image1, image2, image3, image4, image5, image6)[/color]
    unlink
    [color=blue]
    > - Display images (newimagename1, newimagename2_2 , newimagename3_3 ,
    > newimagename4_4 , newimagename5_5 , newimagename6_6 )[/color]
    <img src="newimagena me1"> ...
    [color=blue]
    > with link to biger images (newimagename1, newimagename2, newimagename3,
    > newimagename4, newimagename5, newimagename6)[/color]
    <a href="bigger_im age"><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 :

    Comment

    Working...