SunQuest
 
           Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old March 30th, 2003, 05:53 AM
Martin Krumme Martin Krumme is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 Martin Krumme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Resizing JPEG

I've tried to reproduce Ben Rowes Tutorial on resizing JPEGs, but get the following error message:

"Fatal error: Call to undefined function: imagecreatefromjpeg() ..."

That relates to these snippets:

$img_orig_size = getimagesize($_FILES['strFile']['tmp_name']);
$img_orig_width = $img_orig_size[0];
$img_orig_height = $img_orig_size[1];
$img_original = ImageCreateFromJpeg($_FILES['strFile']['tmp_name']);
$image_stored = time() . "_$name.jpg";

Could someone give me a helping hand?

--
Martin Krumme

Reply With Quote
  #2  
Old March 30th, 2003, 01:19 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Is GD installed on your server? If not, you can download it from here.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old March 30th, 2003, 02:42 PM
Martin Krumme Martin Krumme is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 Martin Krumme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Yes it is - and in the meantime I've found that the problem is only on my local platform (W2k - GD is installed). My provider runs Apache and after changing the chmod for the image directory everything goes as you wrote. Thank you very much.
If I don't mess you I have two more questions:

a) Is there a solution for gif-images?
b) How could I save the image-names in a mysql-database?

Thanks again for the tutorial :-))

Martin

Reply With Quote
  #4  
Old March 30th, 2003, 08:52 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
There is no solution for gifs that I know of because they are actually under some copy right law for the encyption or something, as for the file names, one of the variables in that code, contains the file names, all you need to do is run a database query to insert that variable into the database.

Reply With Quote
  #5  
Old March 31st, 2003, 05:56 AM
Martin Krumme Martin Krumme is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 Martin Krumme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post

Thanks again for the infos!

Reply With Quote
  #6  
Old March 31st, 2003, 11:26 AM
Martin Krumme Martin Krumme is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 Martin Krumme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Quote:
Originally posted by Ben Rowe
... as for the file names, one of the variables in that code, contains the file names, all you need to do is run a database query to insert that variable into the database.


I've tried ... but up to now in vain - the database did not smile to me.


$image_stored = time() . "_$name.jpg";
ImageJPEG($img_original, "$IMG_ROOT/$image_stored");
echo "Image Name: {$_FILES['strFile']['name']}<br>
New Image Name: $image_stored<br>
Width: $img_orig_width<br>
Height: $img_orig_height<br>
Max Image Size for Thumbnails: $IMG_WIDTH x $IMG_HEIGHT<br>
<a target='_blank' href='$IMG_ROOT/$image_stored'>View Original Image</a><br><br>";
mysql_select_db("xyz");
$sql = "INSERT INTO filestore SET
bildgr='$IMG_ROOT/$image_stored'";
mysql_select_db("xyz");
$sql = "INSERT INTO filestore SET
bildgr='$IMG_ROOT/$image_stored'";


Where is my fault - if someone would be so kind to tell me.

--
Martin

Reply With Quote
  #7  
Old March 31st, 2003, 02:23 PM
Martin Krumme Martin Krumme is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 Martin Krumme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
In the "heat of the night" I forgot that:

$action = mysql_query($sql);

Everything works!!

Reply With Quote
  #8  
Old April 21st, 2003, 10:19 AM
jinx jinx is offline
it's not a tumor
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 22 jinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ImageMagick

As a note, ImageMagick is another good alternative to, or along with GD. You just run the commands with shell commands for ImageMagick using:
PHP Code:
 exec($shell_command); 


There site is http://www.imagemagick.com

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Resizing JPEG


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway