Go to Post Personally, I think the solution involves looking at the past. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-10-2004, 23:29
ryan_f ryan_f is offline
Registered User
#1053
 
Join Date: Jan 2003
Location: ottawa
Posts: 71
ryan_f is an unknown quantity at this point
File resize?

Im working on a website right now and i made a script in php to upload an image and then display it on a different page. It works very well. My only problem is that i want to be able to turn those images into thumbnails with small file sizes automatically once i upload the file to my server. I don't really know that much php and i have no idea how i would accomplish this
  #2   Spotlight this post!  
Unread 09-10-2004, 23:33
JakeGallagher's Avatar
JakeGallagher JakeGallagher is offline
Mmmm Hot Sauce
#0134 (Team Discovery)
Team Role: Operator
 
Join Date: Mar 2004
Rookie Year: 2003
Location: Pembroke, New Hampshire
Posts: 257
JakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant futureJakeGallagher has a brilliant future
Send a message via ICQ to JakeGallagher Send a message via AIM to JakeGallagher Send a message via MSN to JakeGallagher Send a message via Yahoo to JakeGallagher
Re: File resize?

I don't know a lot about php either, but I think I saw somewhere that Photoshop has a utility included in it somewhere that allows you to create php galleries similar to Windows Explorer Filmstrip picture viewing... does your team have a copy of PS? Maybe other editors have this same feature (Paint Shop Pro, CoredDRAW, etc.)
Check those out.
__________________
I haven't updated my signature since last May. Who wants to suggest a replacement?
  #3   Spotlight this post!  
Unread 09-10-2004, 23:35
ryan_f ryan_f is offline
Registered User
#1053
 
Join Date: Jan 2003
Location: ottawa
Posts: 71
ryan_f is an unknown quantity at this point
Re: File resize?

yes we do have a copy of photoshop but i've never heard of a utility like that. But i also do not know much about photoshop
  #4   Spotlight this post!  
Unread 09-10-2004, 23:50
Leonas's Avatar
Leonas Leonas is offline
Registered User
#0179 (Children of the Swamp)
Team Role: Student
 
Join Date: Oct 2004
Location: Palm Beach County, Florida
Posts: 10
Leonas is an unknown quantity at this point
Send a message via AIM to Leonas Send a message via MSN to Leonas
Re: File resize?

Download a copy of some forum software like Vbulletin, phpBB, or Invision, open it in Dreamweaver, and do a code search of the entire folder that you have to make into a site for "image resize" or "resize".
__________________
  #5   Spotlight this post!  
Unread 10-10-2004, 01:00
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,576
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: File resize?

you'll want another library such as GD or ImageMagick to do the resizing. Googling those should give you plenty of material to get you started.
  #6   Spotlight this post!  
Unread 10-10-2004, 01:12
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Re: File resize?

Quote:
Originally Posted by ryan_f
Im working on a website right now and i made a script in php to upload an image and then display it on a different page. It works very well. My only problem is that i want to be able to turn those images into thumbnails with small file sizes automatically once i upload the file to my server. I don't really know that much php and i have no idea how i would accomplish this
Could you just use something like Gallery?

If not, I've done some work on that, you can check this link:

http://users.wpi.edu/~woloi/pictures.txt

I haven't looked at that since early summer, so I can't say I know what I did, but if you can't figure out what I did, I'd be more than happy to look back at it and help you. I believe the only problem should be mess and such, cause I never actually cleaned that code up.

Specifically, look at the following code, though it will need to be modified for your purposes:

Code:
 function Thumbnails ($pics, $root, $thumbnails) {
#Pre: $pics is filled
#Post: Thumbnails are created for every new picture in directory

	if ( !is_dir($thumbnails)) {
		mkdir ($thumbnails);
		chmod ($thumbnails, 0755); 
	}
	else if (is_dir ($thumbnails)) {
		for ($i = 0; $i < count($pics); $i++) {
			if (!is_file($thumbnails . '/' . $pics[$i])) {
				exec ("convert $root/$pics[$i] -resize 150x150 +profile '*' $thumbnails/$pics[$i]");
				chmod ("$thumbnails/$pics[$i]", 0755);
			}
		}
Hope that helps.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #7   Spotlight this post!  
Unread 10-10-2004, 01:53
sanddrag sanddrag is offline
On to my 16th year in FRC
FRC #0696 (Circuit Breakers)
Team Role: Teacher
 
Join Date: Jul 2002
Rookie Year: 2002
Location: Glendale, CA
Posts: 8,516
sanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond repute
Re: File resize?

In CPanel, does Fantastico have anything useful? (providing that you have CPanel and Fantastico)
__________________
Teacher/Engineer/Machinist - Team 696 Circuit Breakers, 2011 - Present
Mentor/Engineer/Machinist, Team 968 RAWC, 2007-2010
Technical Mentor, Team 696 Circuit Breakers, 2005-2007
Student Mechanical Leader and Driver, Team 696 Circuit Breakers, 2002-2004
  #8   Spotlight this post!  
Unread 10-10-2004, 01:58
ahecht's Avatar
ahecht ahecht is offline
'Luzer'
AKA: Zan
no team
Team Role: Alumni
 
Join Date: Dec 2001
Rookie Year: 2002
Location: Billerica, MA
Posts: 978
ahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond reputeahecht has a reputation beyond repute
Send a message via ICQ to ahecht Send a message via AIM to ahecht Send a message via Yahoo to ahecht
Re: File resize?

Quote:
Originally Posted by Ian W.
Specifically, look at the following code, though it will need to be modified for your purposes:
You ran "convert", so I assume you are using ImageMagick on your end, right?
__________________
Zan Hecht

Scorekeeper: '05 Championship DaVinci Field/'10 WPI Regional
Co-Founder: WPI-EBOT Educational Robotics Program
Alumnus: WPI/Mass Academy Team #190
Alumnus (and founder): Oakwood Robotics Team #992


"Life is an odd numbered problem the answer isn't in the back of the book." — Anonymous WPI Student
  #9   Spotlight this post!  
Unread 10-10-2004, 11:33
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: File resize?

Quote:
Originally Posted by ryan_f
Im working on a website right now and i made a script in php to upload an image and then display it on a different page. It works very well. My only problem is that i want to be able to turn those images into thumbnails with small file sizes automatically once i upload the file to my server. I don't really know that much php and i have no idea how i would accomplish this
Here is a snippet of code i wrote for an image gallery a while back. It has extensie debug statements that will give you som insight into its operation. It was adapted from some code i found in the PHP documentation. Note your server must have the GD library installed for this to work

PHP Code:
function image_createThumb($src,$dest,$maxWidth,$maxHeight,$quality=100) {
  print 
'$src  = ' $src '<br>';
  if (isset(
$dest)) {print '$dest is set<br>';} else {print '$dest is not set<br>';}
   if (
file_exists($src)  && isset($dest)) {
        print(
'JPEG Quality: ' $quality .'<BR>');
       
// path info
       
$destInfo  pathInfo($dest);

       
// image src size
       
$srcSize  getImageSize($src);

       
// image dest size $destSize[0] = width, $destSize[1] = height
       
$srcRatio  $srcSize[0]/$srcSize[1]; // width/height ratio
       
$destRatio $maxWidth/$maxHeight;
       if (
$destRatio $srcRatio) {
           
$destSize[1] = $maxHeight;
           
$destSize[0] = $maxHeight*$srcRatio;
       }
       else {
           
$destSize[0] = $maxWidth;
           
$destSize[1] = $maxWidth/$srcRatio;
       }

       
// path rectification
       
if ($destInfo['extension'] == "gif") {
           
$dest substr_replace($dest'jpg', -3);
       }

       
// true color image, with anti-aliasing
       
print '$maxHeight  = ' $maxHeight '<br>';
       print 
'$maxWidth   = ' $maxWidth '<br>';
       print 
'src height  = ' $srcSize[1] . '<br>';
       print 
'src width   = ' $srcSize[0] . '<br>';
       print 
'dest height = ' $destSize[1] . '<br>';
       print 
'dest width  = ' $destSize[0] . '<br>';
       
$destImage imagecreatetruecolor($destSize[0],$destSize[1]);
       
imageAntiAlias($destImage,true);

       
// src image
       
switch ($srcSize[2]) {
           case 
1//GIF
           
$srcImage imageCreateFromGif($src);
           break;

           case 
2//JPEG
           
$srcImage imageCreateFromJpeg($src);
           break;

           case 
3//PNG
           
$srcImage imageCreateFromPng($src);
           break;

           default:
           return 
false;
           break;
       }

       
// resampling
       
imageCopyResampled($destImage$srcImage0000,$destSize[0],$destSize[1],$srcSize[0],$srcSize[1]);

       
// generating image
       
switch ($srcSize[2]) {
           case 
1:
           case 
2:
           
imageJpeg($destImage,$dest,$quality);
           break;

           case 
3:
           
imagePng($destImage,$dest);
           break;
       }
       return 
true;
   }
   else {
       print 
'file does not exist<br>';
       return 
false;

   }

__________________
1139 Alumni

Last edited by Rickertsen2 : 10-10-2004 at 11:36.
  #10   Spotlight this post!  
Unread 10-10-2004, 12:03
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Re: File resize?

Quote:
Originally Posted by ahecht
You ran "convert", so I assume you are using ImageMagick on your end, right?
Yes, I can't remember why I picked ImageMagick, but it works, and it's fairly easy to use.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
Closed Thread


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save a quicktime .mov file? Elgin Clock IT / Communications 20 18-03-2005 17:39
heres the code. y this not working omega Programming 16 31-03-2004 15:18
How do we convert a modified user routines file into a valid .HEX file HuskieRobotics Programming 13 28-02-2004 12:12
Dashv2.ocx dependency file now available archiver 2000 0 23-06-2002 22:00
Improving PBASIC: Request for Comments Greg Ross Programming 19 16-02-2002 22:14


All times are GMT -5. The time now is 00:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi