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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 > > |
|
|||
|
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 > > |
|
|||
|
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 >> >> > |
|
|||
|
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 > >> > >> > > > |