hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Feedback on PHP image script?
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Feedback on PHP image script?

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-19-2005, 05:06 AM
GeorgeC GeorgeC is offline
Web Hosting Master
 
Join Date: Sep 2000
Posts: 1,003

Feedback on PHP image script?


Hi:
I'm looking for some feedback on this PHP image optimizing script I just completed: http://webmasterpick.com/gifoptimize/ Please let me know if you find any bugs or other more serious issues (pm please when more appropriate). What about a certain features that you think are missing or would be useful?

Thanks,

Reply With Quote


Sponsored Links
  #2  
Old 03-19-2005, 12:09 PM
funkytaco funkytaco is offline
Web Hosting Guru
 
Join Date: Mar 2005
Posts: 290
Awesome script.

Reply With Quote
  #3  
Old 03-19-2005, 05:38 PM
GeorgeC GeorgeC is offline
Web Hosting Master
 
Join Date: Sep 2000
Posts: 1,003
Thanks. If anyone has feedback on bugs or potential security issues, please let me know as well.

Reply With Quote
Sponsored Links
  #4  
Old 03-19-2005, 05:56 PM
stormraven stormraven is offline
WHT Addict
 
Join Date: Apr 2004
Location: Port St Lucie, FL
Posts: 117
Sweet script!

__________________
Paul Embry
Knight Software and Web Design
Paul.Embry@gmail.com
Quality PHP Web Programming for Reasonable Prices

Reply With Quote
  #5  
Old 03-21-2005, 09:40 AM
bentruyman bentruyman is offline
Junior Guru Wannabe
 
Join Date: Feb 2005
Posts: 37
Nice.

Why not make another one in which you can resize it by percentage, number, best fit ratio, and resample it to a set quality? :-)

It's actually really. I just did one in fact for a client.

-Ben

__________________
Experience:
Photoshop CS3, Dreamweaver, Fireworks, Flash, HTML, Javascript, PHP/MySQL Database, CMS

Reply With Quote
  #6  
Old 03-21-2005, 09:50 AM
bentruyman bentruyman is offline
Junior Guru Wannabe
 
Join Date: Feb 2005
Posts: 37
This is my script. I had a little help from someone here on WHT. But all the calculations are mine.

PHP Code:
<?
/*==Image Resizer=====================================*/
/*This script currently does NOT support other formats*/
/*other than JPG or JPEG.  Though, I made it for      */
/*photos which should be in JPG format anyways.       */
/*Basically, it will take the file uploaded, determine*/
/*which proportion is greater (width or height) and   */
/*resize it to fit within the constraints given.      */
/*====================================================*/
/*Notice the calculations.*/
function resizeToFile ($sourcefile$max_x$max_y$targetfile$jpegqual) {
/* Get the dimensions of the source picture */
$picsize=getimagesize("$sourcefile");
$source_x $picsize[0];
$source_y  $picsize[1];
$source_id imageCreateFromJPEG("$sourcefile");
/* Best fit image */
/*This is where the script checks for the greater ratio.*/
/*If you have an image resize script, this would be the */
/*section that determines the 'best fit' for a pair of  */
/*constraints given.                                    */
if(($source_x/$max_x) > ($source_y/$max_y))
{
    
$ratio $source_x/$max_x;
    
$max_y=$source_y/$ratio;
}
else
{
    
$ratio $source_y/$max_y;
    
$max_x=$source_x/$ratio;
}
/* Create image object */
$target_id=imagecreatetruecolor($max_x$max_y);
/* Resize JPG */
$target_pic=imagecopyresampled($target_id,$source_id,0,0,0,0,$max_x,$max_y,$source_x,$source_y);
/* Create JPG */
imagejpeg ($target_id,"$targetfile",$jpegqual);
return 
true;
}
?>

__________________
Experience:
Photoshop CS3, Dreamweaver, Fireworks, Flash, HTML, Javascript, PHP/MySQL Database, CMS

Reply With Quote
  #7  
Old 03-21-2005, 03:41 PM
mfonda mfonda is offline
WHT Addict
 
Join Date: Feb 2005
Location: Seattle, Washington
Posts: 144
easybyte: hard to give feedback, especially on "bugs or potential security issues" as you request, if you do not post the PHP code to it.

nonetheless, looks cool, a nice idea, and useful

__________________
Regards,
Matthew Fonda
PHP Developer

Reply With Quote
  #8  
Old 03-21-2005, 04:08 PM
Bakie Bakie is offline
Community Guide
 
Join Date: Mar 2005
Location: England
Posts: 1,201
Looks good but I havent tried it out yet but I will probably need it soon so I bookmarked it.

Reply With Quote
  #9  
Old 03-21-2005, 04:42 PM
pergesu pergesu is offline
Web Hosting Master
 
Join Date: Jun 2004
Posts: 789
When I tried it, it said the pic was too big.

http://www.photofile.com/Photos/Albu...rmeloASG01.jpg

Not that big of an image, really.

Reply With Quote
  #10  
Old 03-21-2005, 04:50 PM
GeorgeC GeorgeC is offline
Web Hosting Master
 
Join Date: Sep 2000
Posts: 1,003
Quote:
Originally posted by pergesu
When I tried it, it said the pic was too big.

http://www.photofile.com/Photos/Albu...rmeloASG01.jpg

Not that big of an image, really.
Currently I'm limiting image size to 100k, so you're getting that error (image is 140k). I'll probably double that limit depending on how it affects my server resources.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Phoenix NAP Responds to Customer Feedback with New Cloud Features Web Hosting News 2013-02-19 17:09:09
Phoenix NAP Aims to Improve Cloud Hosting through Customer Feedback Website Web Hosting News 2013-01-17 13:59:49
Microsoft Partners Network "Speed-Dating" Style in Toronto Blog 2012-07-11 15:56:47
Control Panel cPanel Launches New Apache Configuration Script Web Hosting News 2011-12-28 19:41:39
Web Host JaguarPC Adds Auto-Installer Softaculous to Hosting Plans Web Hosting News 2011-07-27 18:55:46


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?