image uploading/resizing best practices in PHP

This is a discussion on image uploading/resizing best practices in PHP within the PHP General forums, part of the PHP Programming Forums category; Dear All, I would like to make a script to upload a jpg filewith php to a server; then make ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-22-2007
Dwayne Heronimo
 
Posts: n/a
Default image uploading/resizing best practices in PHP

Dear All,

I would like to make a script to upload a jpg filewith php to a server; then
make a thumb; save if for later use. And store the path to the image in a
database to display it later. But what is the best practice to do this on a
relatively low traffic website?

I dont know where to begin but I have 2 appoaches:

1. To make a script to upload the image and resize this on the fly and store
only the thumb image somewhere for later use. While also to store the image
path in de database for later retrieval.

2. to make a script to only upload the image as is and then insert the image
path in the database for later use. And upon displaying the image to use
like a nondistructive <img scr="resizer.php?imgfile=image.jpg&width=250"
border=0> resizer to display the image in the desired dimentions.

Which one would be the best practice now a days for a relative low traffic
site?
I really have no idean how to build this but I have a good approach I maybe
could start searching for something more specific.

Thanks for your help,

Dwayne
Reply With Quote
  #2 (permalink)  
Old 03-22-2007
Tijnema !
 
Posts: n/a
Default Re: [PHP] image uploading/resizing best practices in PHP

On 3/22/07, Dwayne Heronimo <dwayne@orbitalnets.com> wrote:
> Dear All,
>
> I would like to make a script to upload a jpg filewith php to a server; then
> make a thumb; save if for later use. And store the path to the image in a
> database to display it later. But what is the best practice to do this on a
> relatively low traffic website?
>
> I dont know where to begin but I have 2 appoaches:
>
> 1. To make a script to upload the image and resize this on the fly and store
> only the thumb image somewhere for later use. While also to store the image
> path in de database for later retrieval.


The best way i think if you have enough space on the server to store the thumb.

>
> 2. to make a script to only upload the image as is and then insert the image
> path in the database for later use. And upon displaying the image to use
> like a nondistructive <img scr="resizer.php?imgfile=image.jpg&width=250"
> border=0> resizer to display the image in the desired dimentions.

This one is worser then the first one, because everytime you request
the thumb would cost some CPU power. This isn't a lot, but if you are
gonna process 1000s thumbs a time, it will really make difference in
performance.

>
> Which one would be the best practice now a days for a relative low traffic
> site?
> I really have no idean how to build this but I have a good approach I maybe
> could start searching for something more specific.
>
> Thanks for your help,
>
> Dwayne
>

You should have a look at the image functions of
PHP(www.php.net/image). Creating the thumbs is the hardest part. The
upload part should be no problem with a little bit of google :)
Or you might want to google for a full working scripts, i saw them around.

Tijnema


> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply With Quote
  #3 (permalink)  
Old 03-22-2007
Shafiq Rehman
 
Posts: n/a
Default Re: [PHP] image uploading/resizing best practices in PHP

Option one is much better.

--
Shafiq Rehman (ZCE)
http://phpgurru.com | http://shafiq.pk

On 3/22/07, Tijnema ! <tijnema@gmail.com> wrote:
>
> On 3/22/07, Dwayne Heronimo <dwayne@orbitalnets.com> wrote:
> > Dear All,
> >
> > I would like to make a script to upload a jpg filewith php to a server;

> then
> > make a thumb; save if for later use. And store the path to the image in

> a
> > database to display it later. But what is the best practice to do this

> on a
> > relatively low traffic website?
> >
> > I dont know where to begin but I have 2 appoaches:
> >
> > 1. To make a script to upload the image and resize this on the fly and

> store
> > only the thumb image somewhere for later use. While also to store the

> image
> > path in de database for later retrieval.

>
> The best way i think if you have enough space on the server to store the
> thumb.
>
> >
> > 2. to make a script to only upload the image as is and then insert the

> image
> > path in the database for later use. And upon displaying the image to use
> > like a nondistructive <img scr="resizer.php?imgfile=image.jpg&width=250"
> > border=0> resizer to display the image in the desired dimentions.

> This one is worser then the first one, because everytime you request
> the thumb would cost some CPU power. This isn't a lot, but if you are
> gonna process 1000s thumbs a time, it will really make difference in
> performance.
>
> >
> > Which one would be the best practice now a days for a relative low

> traffic
> > site?
> > I really have no idean how to build this but I have a good approach I

> maybe
> > could start searching for something more specific.
> >
> > Thanks for your help,
> >
> > Dwayne
> >

> You should have a look at the image functions of
> PHP(www.php.net/image). Creating the thumbs is the hardest part. The
> upload part should be no problem with a little bit of google :)
> Or you might want to google for a full working scripts, i saw them around.
>
> Tijnema
>
>
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Reply With Quote
  #4 (permalink)  
Old 03-22-2007
Dwayne Heronimo
 
Posts: n/a
Default Re: [PHP] image uploading/resizing best practices in PHP

thx for the input. I was afraid that it would be option 1 because it is more
complex.
I will start googling. ;)

Thx

""Shafiq Rehman"" <rehmanms@gmail.com> wrote in message
news:35963d3c0703220426q70cae1fdp2193e9e840c8a13@m ail.gmail.com...
> Option one is much better.
>
> --
> Shafiq Rehman (ZCE)
> http://phpgurru.com | http://shafiq.pk
>
> On 3/22/07, Tijnema ! <tijnema@gmail.com> wrote:
>>
>> On 3/22/07, Dwayne Heronimo <dwayne@orbitalnets.com> wrote:
>> > Dear All,
>> >
>> > I would like to make a script to upload a jpg filewith php to a server;

>> then
>> > make a thumb; save if for later use. And store the path to the image in

>> a
>> > database to display it later. But what is the best practice to do this

>> on a
>> > relatively low traffic website?
>> >
>> > I dont know where to begin but I have 2 appoaches:
>> >
>> > 1. To make a script to upload the image and resize this on the fly and

>> store
>> > only the thumb image somewhere for later use. While also to store the

>> image
>> > path in de database for later retrieval.

>>
>> The best way i think if you have enough space on the server to store the
>> thumb.
>>
>> >
>> > 2. to make a script to only upload the image as is and then insert the

>> image
>> > path in the database for later use. And upon displaying the image to
>> > use
>> > like a nondistructive <img
>> > scr="resizer.php?imgfile=image.jpg&width=250"
>> > border=0> resizer to display the image in the desired dimentions.

>> This one is worser then the first one, because everytime you request
>> the thumb would cost some CPU power. This isn't a lot, but if you are
>> gonna process 1000s thumbs a time, it will really make difference in
>> performance.
>>
>> >
>> > Which one would be the best practice now a days for a relative low

>> traffic
>> > site?
>> > I really have no idean how to build this but I have a good approach I

>> maybe
>> > could start searching for something more specific.
>> >
>> > Thanks for your help,
>> >
>> > Dwayne
>> >

>> You should have a look at the image functions of
>> PHP(www.php.net/image). Creating the thumbs is the hardest part. The
>> upload part should be no problem with a little bit of google :)
>> Or you might want to google for a full working scripts, i saw them
>> around.
>>
>> Tijnema
>>
>>
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >

>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

>

Reply With Quote
  #5 (permalink)  
Old 03-22-2007
Németh Zoltán
 
Posts: n/a
Default Re: [PHP] image uploading/resizing best practices in PHP

2007. 03. 22, csütörtök keltezéssel 12.48-kor Dwayne Heronimo ezt Ã*rta:
> thx for the input. I was afraid that it would be option 1 because it is more
> complex.


why would resizing and then storing it be more complex than resizing and
then displaying it?

greets
Zoltán Németh

> I will start googling. ;)
>
> Thx
>
> ""Shafiq Rehman"" <rehmanms@gmail.com> wrote in message
> news:35963d3c0703220426q70cae1fdp2193e9e840c8a13@m ail.gmail.com...
> > Option one is much better.
> >
> > --
> > Shafiq Rehman (ZCE)
> > http://phpgurru.com | http://shafiq.pk
> >
> > On 3/22/07, Tijnema ! <tijnema@gmail.com> wrote:
> >>
> >> On 3/22/07, Dwayne Heronimo <dwayne@orbitalnets.com> wrote:
> >> > Dear All,
> >> >
> >> > I would like to make a script to upload a jpg filewith php to a server;
> >> then
> >> > make a thumb; save if for later use. And store the path to the image in
> >> a
> >> > database to display it later. But what is the best practice to do this
> >> on a
> >> > relatively low traffic website?
> >> >
> >> > I dont know where to begin but I have 2 appoaches:
> >> >
> >> > 1. To make a script to upload the image and resize this on the fly and
> >> store
> >> > only the thumb image somewhere for later use. While also to store the
> >> image
> >> > path in de database for later retrieval.
> >>
> >> The best way i think if you have enough space on the server to store the
> >> thumb.
> >>
> >> >
> >> > 2. to make a script to only upload the image as is and then insert the
> >> image
> >> > path in the database for later use. And upon displaying the image to
> >> > use
> >> > like a nondistructive <img
> >> > scr="resizer.php?imgfile=image.jpg&width=250"
> >> > border=0> resizer to display the image in the desired dimentions.
> >> This one is worser then the first one, because everytime you request
> >> the thumb would cost some CPU power. This isn't a lot, but if you are
> >> gonna process 1000s thumbs a time, it will really make difference in
> >> performance.
> >>
> >> >
> >> > Which one would be the best practice now a days for a relative low
> >> traffic
> >> > site?
> >> > I really have no idean how to build this but I have a good approach I
> >> maybe
> >> > could start searching for something more specific.
> >> >
> >> > Thanks for your help,
> >> >
> >> > Dwayne
> >> >
> >> You should have a look at the image functions of
> >> PHP(www.php.net/image). Creating the thumbs is the hardest part. The
> >> upload part should be no problem with a little bit of google :)
> >> Or you might want to google for a full working scripts, i saw them
> >> around.
> >>
> >> Tijnema
> >>
> >>
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>

> >

>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:19 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0