Re: AW: [PHP] image function
At 04:52 PM 8/13/2002 +0200, Sascha Braun wrote: Okay... I've looked at that library and felt as if I was looking into the ark of the Covenant. I'm really not that good at programing and looking at that script made my eyes bleed. This is a script I've used to save an image and then dynamically resize it proportionately until it is within 200x180. It also renames the file and creates a mysql database entry for the file so my image collection can later be searched. "; if(($temp_h*1.8) > ($temp_w*2)) { $ratio = $temp_w/$temp_h; $dest_w = 200*$ratio; $dest_h = 200; } if(($temp_h*1.8) < ($temp_w*2)) { $ratio = $temp_h/$temp_w; echo "Ratio - $ratio "; $dest_w = 180; $dest_h = 180*$ratio; } //On the off chance that the image is proportionate to 200x180 already we just set the height and width. if(($temp_h*1.8) == ($temp_w*2)) { $dest_w = 180; $dest_h = 200; } //Create the canvas. To use imagecreatetruecolor you need php_gd2.dll listed as an extension $image_t = imagecreatetruecolor($dest_w, $dest_h); //Resize (technically resample) the image to the new canvas imagecopyresampled($image_t, $tempimage, 0, 0, 0, 0, $dest_w, $dest_h, $temp_w, $temp_h); //Save the Thumbnail if(!ImageJpeg($image_t, $image_root.$smallfilename)) { echo "ERROR: Thumbnail Image unable to Upload!"; exit; } } //Clean up imagedestroy($tempimage); imagedestroy($image_t); //Insert File info into MySQL database $imageUpdate = "insert into images (catID, caption, descr, systemID, genreID, game) values ('$f_imageCat', '$f_caption', '$f_descr', '$f_system', '$f_genre', '$f_game')"; if(!mysql_query($imageUpdate, $conn)) { echo "ERROR: Unable to Submit information to Database, try Upload later."; exit; } echo "Image Upload Successful! Image ID is: $newnum"; ?> I am running a windows system, so I know that the JPEG functions do work. Gif functions will NOT WORK as the compression algorithm is now copyrighted. If this script (once tweaked for your system needs) does not work and your php.ini file is included the proper extension I don't know what to say. Nick >I believe the jpeg funnktions don't work on a windows system. The Gifs don't >do either because they aren't implemeted too. > >Please look at this Library. It's very nice but I don't get it working and >the guy who made it don't know either, why it's not working on my system. >Must be something about jpeg librarys and so on. > >Schura > >PS.: Examples at the end of the file. > >-Ursprüngliche Nachricht- >Von: Nicholas Mercier [mailto:[EMAIL PROTECTED]] >Gesendet: Dienstag, 13. August 2002 10:35 >An: [EMAIL PROTECTED] >Betreff: Re: [PHP] image function -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] image function
At 03:37 AM 8/13/2002 +0200, you wrote: Hey there, I created a set of scripts that did basically what you are looking to do. THINGS TO CHECK: 1. You may have a problem if you uncommented both DLL files. Apache will complain when it tries to load two libraries with the same functions in them. 2.Make sure that the dll file is in the correct place. It should match the extension directory listed in your php.ini file. 3.Additionally you may want to copy the DLL to your WINNT/SYSTEM directory (don't know why, but I've been told this helps.) 4.Stop and restart Apache 5. When uploading an image to be resized realize that the data may type image/pjpeg (progressive jpeg) and not image/jpeg (This caused my scripts to choke on me when checking image types for filtering purposes) If PHP 4.2.2 doesn't support Jpeg then that is odd since I'm working with version 4.1.1 and I have no problems with my image scripts. Feel free to reply if you'd like to show me your scripts or ask for additional clarification. Nick >Hello, > >I got the same Problem right yet. I´m using an create thumbnail library on >my website, but the class don't work on my computer and either not on my >webspace where i tested it too. > >On my Computer there is installed Win2K with apache 2.0.35 and PHP 4.2.2. I >used both GDLibs wich came along with my PHP Package, but they both didn't >have support for Jpeg Images. > >I'm running ill while I work on this shit. 'Cause I need to create to create >Thumbs from very large images, they're about 2.5 MB each. And right yet I >don't know some about performance and if it will work ever. Later the hole >site will run on an dedicated Linux machine. But I'm not the super pro on >installing and compiling packages on a linux systems. And it would be nice >if i could test the scripts on my WinNT 5 machine. > >Please tell me what you found out yet! - I got a very nice image creation >library, wich is under GPL. I'm going to send it soon to ya if you want it. > >Thanks > >Schura > >-Ursprüngliche Nachricht- >Von: NoWhErEMan [mailto:[EMAIL PROTECTED]] >Gesendet: Montag, 12. August 2002 15:50 >An: [EMAIL PROTECTED] >Betreff: Re: [PHP] image function > > >Thank you Jay, Yup my apache is on Windows : ) >Let's me try first. >"Jay Blanchard" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D >:002301c24201$b28caf00$[EMAIL PROTECTED] > > [snip] > > I known i need to install a lot of staffs to get all the functions >works(GD > > Lib, FreeType Lib, libjpeg, libpng, zlibetc etc). > > But i only need a few of them, so if i just load the php_gd.dll, what > > functions included?? I canr found any information about that. > > And one more, does php_gd2.dll also a GD lib? > > [/snip] > > > > The DLL is a Windows library AFAIR, and contains the GD functions when > > included on a Windows server. You do not have to enable this extension on >an > > Apache server (unless it is Apache on Windows). You just have to make sure > > that PHP is compiled with all of the proper libraries for your use of GD. > > > > As for the second DLL, I am not sure. I haven't done a lot of Windows GD > > installations, it does not look familiar. > > > > HTH! > > > > Jay > > > > > > > >-- >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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php