To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Code Critique

Code Critique Having someone critique your code is always a great way to hone the skills. Stop in and post your code to see what your peers may have done differently.

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-23-2003, 08:38 PM   #1
drawmack
Computers can do that?
 
drawmack's Avatar
 
Join Date: Apr 2003
Location: Pocono Mtns PA
Posts: 3,268
Dynamic Thumbnail Creation

Attached is a file that contains the code to resize an image to a thumbnail. I did this up in tutorial format because I couldn't find a good tutorial on the subject. Here it is for comment, critique and dismemberment.

[EDIT]
Updated the script with a bug fix and the changes suggested by moonglobe.
[/EDIT]
Attached Files
File Type: zip ewd_mt_10.zip (9.6 KB, 197 views)

Last edited by drawmack; 11-27-2003 at 11:49 PM.
drawmack is offline   Reply With Quote
Old 11-24-2003, 06:00 AM   #2
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Maybe you should add an automatic folder creator within it. I had an error thinking it would work first time. But other than that its not bad at all. Though i suggest you use move_uploaded_file instead of copy because some systems have safe mode on. But im sure this wont be used as anything else but just test and learning experience..

Nice stuff
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 11-24-2003, 12:47 PM   #3
drawmack
Computers can do that?
 
drawmack's Avatar
 
Join Date: Apr 2003
Location: Pocono Mtns PA
Posts: 3,268
Thanks planet, I'll implement the changes you suggest and repost the new version.
drawmack is offline   Reply With Quote
Old 11-24-2003, 12:52 PM   #4
KITTfan2K
Farscape Rules!
 
KITTfan2K's Avatar
 
Join Date: Oct 2002
Location: Uncharted Territories
Posts: 119
Quote:
Originally posted by planetsim
Though i suggest you use move_uploaded_file instead of copy because some systems have safe mode on. But im sure this wont be used as anything else but just test and learning experience..

Nice stuff
Are you actually allowed to upload files when safe mode is on?

KITTfan2K
KITTfan2K is offline   Reply With Quote
Old 11-25-2003, 03:35 AM   #5
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Yes it works read it on here

http://www.php.net/manual/en/functio...oaded-file.php It repeats itself twice about it working with safemode enabled
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 11-25-2003, 05:22 AM   #6
KITTfan2K
Farscape Rules!
 
KITTfan2K's Avatar
 
Join Date: Oct 2002
Location: Uncharted Territories
Posts: 119
Quote:
Originally posted by planetsim
Yes it works read it on here

http://www.php.net/manual/en/functio...oaded-file.php It repeats itself twice about it working with safemode enabled
I mean, if Safe Mode was on, would the file be uploaded correctly, before we get to moving it...

I think that Invision File Manager says that safe mode restricts the uploading of files.

KITTfan2K
KITTfan2K is offline   Reply With Quote
Old 11-25-2003, 12:51 PM   #7
Moonglobe
Better fan than rebelo!
 
Moonglobe's Avatar
 
Join Date: Apr 2003
Location: brain://localhost:left-side
Posts: 2,381
isn't it rather stupid using error_reporting(E_ALL) and then using all those @ signs?
__________________
there's no place i can be, since i found serenity.
Moonglobe is offline   Reply With Quote
Old 11-25-2003, 06:25 PM   #8
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
KITTfan2K just to answer your question, ive used move_uploaded_file many times on safe mode, i actually work with my current settings with safe_mode = on, just because of the restrictions it gives. The only way that move_uploaded_file will not work is if the function was disabled, other than that it works practically the just about the same other than it works in safe mode regardless
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 11-26-2003, 12:09 AM   #9
drawmack
Computers can do that?
 
drawmack's Avatar
 
Join Date: Apr 2003
Location: Pocono Mtns PA
Posts: 3,268
Quote:
Originally posted by Moonglobe
isn't it rather stupid using error_reporting(E_ALL) and then using all those @ signs?
ooppss forgot to take the E_ALL out I use that for testing but it shouldn't be in production code cause it slows it down.
drawmack is offline   Reply With Quote
Old 11-26-2003, 12:11 AM   #10
Moonglobe
Better fan than rebelo!
 
Moonglobe's Avatar
 
Join Date: Apr 2003
Location: brain://localhost:left-side
Posts: 2,381
i dont see how..... and if it does its more infinitismal than the differene between ' and " for most things. however if you can use E_ALL and have no errors on a production box, you have some pretty solid code.

(of course noone should be displaying errors, only logging them for production)
__________________
there's no place i can be, since i found serenity.
Moonglobe is offline   Reply With Quote
Old 11-27-2003, 11:51 PM   #11
drawmack
Computers can do that?
 
drawmack's Avatar
 
Join Date: Apr 2003
Location: Pocono Mtns PA
Posts: 3,268
I do my absolute best to generate no errors in production code. My errors in production code are emailed to a mailbox that is linked to my beeper so my beeper goes off every time one of my production sites generates an error. That's what I call motivation to not generate errors.
drawmack is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:51 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.