[PHP] Re: Image Type BMP @ Save Image As Dialog on IE
Nitsan Bin-Nun napsal(a): I have wrote a PHP script that serves JPEG images in smaller size, the resize is done using GD on-the-fly. I have noticed an interesting issue during the save image as... dialog on serveral internet explorer browsers, somehow, for some strange reason, the JPEG file is shown as BMP file. I don't know why this is happening, but I'm trying to make it save it as JPG file. In firefox or any other browser everything works like a charm. I have to mention that the JPG file is located in the HTML in the following format: img src='xxx.jpg' alt='aaa' style='border:0;' / I have also used mod_rewrite to serve the file with .jpg extension (I thought that the strange IE may not know how to recognize it..), the PHP file is sending the correct headers, I'm attaching an example for HTTP request response for this resized image: GET /gallery-image-dolphinim-12450163853. HTTP/1.1 Host: www.dolphinim.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 FirePHP/0.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: PHPSESSID=e4542edfa5bcb7904e351d39c341fffa HTTP/1.x 200 OK Date: Fri, 26 Jun 2009 16:18:52 GMT Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 DAV/1.0.3 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5 X-Powered-By: PHP/5.2.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: image/jpeg Any directions will be highly appreciated! Thanks! I have noticed the same thing... although after the temporary files clean up and refresh it works OK. So, this is an IE bug - I have not found any workaround. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Type BMP @ Save Image As Dialog on IE
I have been working on it for a while but no luck. I personally don't have IE to test it but my customer have noticed it and brought it up to the table. If you have any ideas I would like to hear you out :) On Sun, Jun 28, 2009 at 5:28 PM, Martin Zvarík mzva...@gmail.com wrote: Nitsan Bin-Nun napsal(a): I have wrote a PHP script that serves JPEG images in smaller size, the resize is done using GD on-the-fly. I have noticed an interesting issue during the save image as... dialog on serveral internet explorer browsers, somehow, for some strange reason, the JPEG file is shown as BMP file. I don't know why this is happening, but I'm trying to make it save it as JPG file. In firefox or any other browser everything works like a charm. I have to mention that the JPG file is located in the HTML in the following format: img src='xxx.jpg' alt='aaa' style='border:0;' / I have also used mod_rewrite to serve the file with .jpg extension (I thought that the strange IE may not know how to recognize it..), the PHP file is sending the correct headers, I'm attaching an example for HTTP request response for this resized image: GET /gallery-image-dolphinim-12450163853. HTTP/1.1 Host: www.dolphinim.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 FirePHP/0.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: PHPSESSID=e4542edfa5bcb7904e351d39c341fffa HTTP/1.x 200 OK Date: Fri, 26 Jun 2009 16:18:52 GMT Server: Apache/1.3.41 (Unix) PHP/5.2.6 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 DAV/1.0.3 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5 X-Powered-By: PHP/5.2.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: image/jpeg Any directions will be highly appreciated! Thanks! I have noticed the same thing... although after the temporary files clean up and refresh it works OK. So, this is an IE bug - I have not found any workaround. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image functions: date?
On 01/12/2007, Dotan Cohen [EMAIL PROTECTED] wrote: I remember once coming across a bit of php code that displayed the created date of a jpeg image. I cannot find it, and I cannot find anything related to that in tfm. Can someone give me a push in the general direction? Thanks in advance. I should clarify: the date that I need is not the date of the file that the filesystem knows about. I need the date that is in the exif data. Thanks. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
[PHP] Re: Image functions: date?
On 01/12/2007, Dotan Cohen [EMAIL PROTECTED] wrote: On 01/12/2007, Dotan Cohen [EMAIL PROTECTED] wrote: I remember once coming across a bit of php code that displayed the created date of a jpeg image. I cannot find it, and I cannot find anything related to that in tfm. Can someone give me a push in the general direction? Thanks in advance. I should clarify: the date that I need is not the date of the file that the filesystem knows about. I need the date that is in the exif data. Thanks. Alright, found it: http://il2.php.net/manual/en/function.exif-read-data.php Sorry for the noise. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
[PHP] Re: image galleries
Lisa A wrote: Does anyone know of an image gallery I can use on multiple pages of a website. I'd like to be able to click on the thumbnails and see a larger image. Hopefully something simple and easy to install. There is Gallery 2, http://gallery.menalto.com/ but that's a bit heavy weight perhaps for your needs. Something involving Lightbox or perhaps a JQuery based system woudl be nice and lightweight fro the client end (they are javascript systems for displaying larger images from thumbnails nicely) and just doing your own lightweight PHP backend is a good soltuion. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image manipulation on the fly
Merlin escreveu: Hi there, I need to manipulate images on the fly. My goal is to make the image very bright, or to add a sepia effect. The problem is, that this takes a lot of computing power on 1024 pictures. About 2s on my server until the image is delivered. ... http://www.educar.pro.br/en/a/gdlib/ -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- Você deve, sempre, consultar uma segunda opinião! -- Deixe todos saberem se esta informação foi-lhe útil. -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image digit to check password
Alain Roger wrote: Hi, There is a trend on internet that when you want to change your password, you need to type : 1. the former password. 2. the new one 3. a 2nd time the new one to confirm that no mistake has been done on step 2. however, several website also propose an additional security to avoid hacking/brute force, they display a 4 digit image with a random string including number and letters... something like A3P23. if user do not respect case and string, password is not changed. I would like to know how such system works and if a tutorial exist about that ? thanks a lot, http://pear.php.net/Text_CAPTCHA http://pear.php.net/package/Text_CAPTCHA_Numeral Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: image manipulation with php
On 8/29/06, zerof [EMAIL PROTECTED] wrote: http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=67 zerof speako englisho, solo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image manipulation with php
Ross escreveu: I have an saved images I output with this... img src=includes/viewphoto.php?id=?=$photo? I want to use getimagesize() to get the height and width of the image and if it is above a certain size then scale/ reduce it. The problems are (i) using getimage() without a url just my viewphoto.php script (ii) comparing and reducing the file Ross http://www.educar.pro.br/abc/gdlib/index.php?pageNum_rsNVER=22totalRows_rsNVER=67 zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image upload problem
Please, check that: http://br.php.net/manual/pt_BR/function.move-uploaded-file.php suresh kumar [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi, This is the code i am using for image upload. if ($_FILES['ufile']['name'] != NULL) { $FlName= $_FILES['ufile']['name']; if(!is_uploaded_file($_FILES['ufile']['tmp_name'])){ print Script type=\text/javascript\ alert(\Error! The expected file wasn't loaded\); /script; exit(); } $uploadfile = $_FILES['ufile']['tmp_name']; $uploadname = $_FILES['ufile']['name']; $uploadtype = $_FILES['ufile']['type']; $tempfile = fopen($uploadfile, 'rb'); $filedata = addslashes(fread($tempfile,filesize($uploadfile))); $UpdateAdQuery = update . $thisAdTableName. set LocalImageName=' . $PostLocalCopy . ', ImageData=' . $filedata . ', ImageName=' . time() . _.$uploadname .', mimetype =' . $uploadtype . ' where ID= . $mID ; $ok = @mysql_query($UpdateAdQuery); } The Code is running properly.But I dont Know Where The uploaded image is Stored in the server.I checked /tmp directory,but image is not there,is there any function where i can specify the location of the server where my image is to be stored i also tired move_uploaded_image() function .but its not working .I am waiting reply from any one - Yahoo! India Answers: Share what you know. Learn something new Click here Catch all the FIFA World Cup 2006 action on Yahoo! India Click here -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image resizing problems
Have you tried imagecopy resized()? John Nichel escribió: I'm pulling my hair out with this gd resizing of an image, and can't figure out where it's screwing up. I've been trying to batch process about 500 images to resize them to a standard size, and for some reason, instead of resizing the image, it's just taking a corner of the original image... $orgimg = imagecreatefromjpeg ( $image_data['image_path'] ); imagecopyresampled ( $im, $orgimg, 0, 0, 0, 0, 250, 250, 600, 600 ); imagejpeg ( $im, $path . $file_name . .temp ); The original images are 600x600, and I'm trying to shrink it down to 250x250, but when I run it thru this it just gives me a 250x250 image which looks to be cropped from the original image (not resized, just the top left corner). This is too much thinking for a Friday. What am I missing??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image resizing problems
Eduardo Raúl Galván Sánchez wrote: Have you tried imagecopy resized()? Same results with that. I'm using imagecopyresampled to keep the quality as high as possible. John Nichel escribió: I'm pulling my hair out with this gd resizing of an image, and can't figure out where it's screwing up. I've been trying to batch process about 500 images to resize them to a standard size, and for some reason, instead of resizing the image, it's just taking a corner of the original image... $orgimg = imagecreatefromjpeg ( $image_data['image_path'] ); imagecopyresampled ( $im, $orgimg, 0, 0, 0, 0, 250, 250, 600, 600 ); imagejpeg ( $im, $path . $file_name . .temp ); The original images are 600x600, and I'm trying to shrink it down to 250x250, but when I run it thru this it just gives me a 250x250 image which looks to be cropped from the original image (not resized, just the top left corner). This is too much thinking for a Friday. What am I missing??? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image location hiding techniques
hbeaumont hbeaumont wrote: I have a site with images that I want people to download but not have the direct path to. ie. I do not want them to be able to just view the source, find the dir and then download everything or direct link to them. Turn off directory indexes or put an index.html file in there. Use mod_rewrite to reject requests from referers starting with http but not being your site. P.S. I also realize I could use .htaccess to stop direct linking and turn off directory indexes. Still I think there might be some other problems with .htaccess Problems like what? -- David Dorward http://blog.dorward.me.uk/ http://dorward.me.uk/ Home is where the ~/.bashrc is -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image location hiding techniques
hbeaumont hbeaumont wrote: Hi, I have a site with images that I want people to download but not have the direct path to. ie. I do not want them to be able to just view the source, find the dir and then download everything or direct link to them. However I can see no way to do this other than keeping the images on disk, having a php script read them and then spit them out. example: view.php?92348924 where 92348924 is a code that translates to the image on disk. Can anyone think of a better method? If not, what is the most efficient way to do this (ie. avoid the most i/o) Thanks! P.S. I also realize I could use .htaccess to stop direct linking and turn off directory indexes. Still I think there might be some other problems with .htaccess I know it's not exactly what you're asking for, but here's a great php based defense against hotlinking. http://www.alistapart.com/articles/hotlinking/ -- * Chuck Anderson • Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image size?
William Stokes escreveu: Hello, Can I get pixel sizes from a uploaded web applicable image with PHP? I mean width and height as pixels. If so How? Thanks -Will -- http://www.educar.pro.br/abc/mathgd/index.php?xyz=30 zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image size?
zerof wrote: William Stokes escreveu: Hello, Can I get pixel sizes from a uploaded web applicable image with PHP? I mean width and height as pixels. If so How? Thanks -Will -- http://www.educar.pro.br/abc/mathgd/index.php?xyz=30 zerof what would the chance be that the OP actually knows Portuguese and could read that? rather small if you ask me... Just to help those that don't have a clue what the link links to, it links to a page describing the getimagesize function (in portuguese). It might have been more helpful to post a simple link to the PHP manual, or even just name the function to use. But that's just my opinion on this matter. We all appreciate the fact that you try to share your knowledge, and help the OP. - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image size?
Try; http://www.php.net/manual/en/function.getimagesize.php Warren At 09:16 AM 1/11/2006, M. Sokolewicz wrote: zerof wrote: William Stokes escreveu: Hello, Can I get pixel sizes from a uploaded web applicable image with PHP? I mean width and height as pixels. If so How? Thanks -Will -- http://www.educar.pro.br/abc/mathgd/index.php?xyz=30 zerof what would the chance be that the OP actually knows Portuguese and could read that? rather small if you ask me... Just to help those that don't have a clue what the link links to, it links to a page describing the getimagesize function (in portuguese). It might have been more helpful to post a simple link to the PHP manual, or even just name the function to use. But that's just my opinion on this matter. We all appreciate the fact that you try to share your knowledge, and help the OP. - tul -- 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] Re: Image size?
what would the chance be that the OP actually knows Portuguese and could read that? --- I don't know what is the chance, but the example in this page doesn't requires to know portuguese. Sorry if you don't speak portuguese. Sorry for my poor english. zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image editing?
Hello, I might have to start doing some automated image editing or rezising with PHP. I've never done anything like this before so I would need some guidelines to get started. Basically what sections of the manual to read and what tools need to be installed to the server side to get things like this done. Are there any websites about this issue, other than php.net, that might provide help to beginners? Thanks for your assistance! http://phpcommunity.org/gazette/2005/aug/imgresize.html http://phpcommunity.org/gazette/2005/jun/img_with_php.html -- Raj Shekhar blog : http://rajshekhar.net/blog home : http://rajshekhar.net Disclaimer : http://rajshekhar.net/disclaimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image editing?
William Stokes wrote: Hello, I might have to start doing some automated image editing or rezising with PHP. I've never done anything like this before so I would need some guidelines to get started. Basically what sections of the manual to read and what tools need to be installed to the server side to get things like this done. Are there any websites about this issue, other than php.net, that might provide help to beginners? Thanks for your assistance! -Will Most photo images need some unsharp mask applied to crisp them back up after being resized. I found I needed ImageMagick to do the job right. If you are concerned about tweaking the quality of your final graphic, you might look into using it. It *is* installed on many servers. There is a Windows version you can install, too. -- * Chuck Anderson • Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image upload form
Nadim Attari wrote: http://www.php-help.net/sources-php/image.upload.function.353.html Thanks, Nadim, I'm sure that is a great script. I am really trying to learn how it's working, so I'm trying to stay away from pre-rolled stuff as much as I can and beg for the mercy of the list in building these simple scripts. Believe it or not I'm actually improving pretty fast (despite scriptorial evidence to the contrary on this list)! Thanks again, JJ Regards, Nadim Attari Alienworkers.com Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; // print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image upload form
http://www.php-help.net/sources-php/image.upload.function.353.html Regards, Nadim Attari Alienworkers.com Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; // print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Ahh now it becomes clear, you where trying to place the image inline. There is a way with base64 encoding, but it isnt supported by many browsers - you can actually say IMG SRC=data:image/png,base64;[...]; where the [...] is the base64 encoded image, so you would need to wrap an ob start and ob end around your code to catch output, then base64 encode it then display it. The problem is it dosnt work in IE because IE dosn't support this. Its also not very nice for anyone not wanting to view images as they will have downloaded the image even though they dont want to see it. There was a very good reason why I know that and have done it, but more then 99.9% of the time, its not the way to go. (the case in example was an embedded application on a machine that had a pseudo-web interface but no webserver - it would wait for a connection on a port then dump a stream of text which would be in HTML - there was no webserver there it would ignore any http headers sent). Aaron Todd wrote: Hey Guys, I think I fixed my own problem. I tried calling the PHP script from a different page like this: img border='0' src='include/pie.php?slice=100total=200' This gave me the results I wanted. Thanks for all your help. Aaron Aaron Todd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Thanks for the compliment on my function. I have since improved upon it...see below. I can do the exact same thing as you and get results, but what I can't do is show the image within an HTML table. I think it is something to do with the header line, but I dont know how to get around it. I've tried just calling the function like I have in the code below. I've also tried calling the function inside of img command. Both ways dont work. Check out the code if you can and let me know if you seen anything that I am doing wrong. Thanks ?php function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255, 255, 255); $black = ImageColorAllocate($im, 0, 0, 0); $white = ImageColorAllocate($im, 255, 255, 255); $red = ImageColorAllocate($im, 255, 0, 0); $blue = ImageColorAllocate($im, 0, 0, 255); //imagefilledellipse($im, 75, 75, 125, 125, $red); //imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $blue, IMG_ARC_PIE); imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_NOFILL); imagefilledarc($im, 75, 75, 125, 125, $pieslice, 315, $red, IMG_ARC_PIE); imagefilledarc($im, 75, 75, 125, 125, $pieslice, 315, $black, IMG_ARC_NOFILL); //Return Header(Content-type: image/png); ImagePNG($im); } echo table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#11' width='200' bgcolor='#FFD1A4' tr td width='100%' colspan='2' align='center'This is a testbr.makepie(20,200)./td /tr /table; ? James Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dude - that works fine! can you check your code - make sure you havnt got any white space at all before the php starts in ANY file, and then check that you've got ALL erros being reported (because you might have the error cant send headers, output allready sent at line x) which will prenvent the header being sent and then you dump the image to the screen which is the random wierd characters (that means the image create functions are all ok and installed, and you have an image object or similar). my code was simple ?php {your function} makepie(10,100); ? NO WHITESPACE NO BLANK LINES NOTHING. (ps you might even have a php include in the php file (php prepend or something?) which might be inserting a space or a newline or ending headers or something. Look at error_reporting() or similar in the manual to turn error reporting on for your script. Hope you find the bug, thats quite a nice function you have there. J Aaron Todd wrote: I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Creation
get rid of : echo table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#11' width='200' bgcolor='#FFD1A4' tr td width='100%' colspan='2' align='center'This is a testbr.makepie(20,200)./td /tr /table; and only have this : makepie(20,200); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Hey Guys, I think I fixed my own problem. I tried calling the PHP script from a different page like this: img border='0' src='include/pie.php?slice=100total=200' This gave me the results I wanted. Thanks for all your help. Aaron Aaron Todd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Dude - that works fine! can you check your code - make sure you havnt got any white space at all before the php starts in ANY file, and then check that you've got ALL erros being reported (because you might have the error cant send headers, output allready sent at line x) which will prenvent the header being sent and then you dump the image to the screen which is the random wierd characters (that means the image create functions are all ok and installed, and you have an image object or similar). my code was simple ?php {your function} makepie(10,100); ? NO WHITESPACE NO BLANK LINES NOTHING. (ps you might even have a php include in the php file (php prepend or something?) which might be inserting a space or a newline or ending headers or something. Look at error_reporting() or similar in the manual to turn error reporting on for your script. Hope you find the bug, thats quite a nice function you have there. J Aaron Todd wrote: I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image manipulation without GD library
Tim Burgan wrote: Hello, Is there any way that I can do some image manipulation - resizing - without the GD libraries? I've always used the GD library and it's the only way that I'm aware of to do resizing. Unless of course you're willing to do all the resizing manually and just upload the new picture to the server in which case you have a lot of options. Heck I think even MS Paint can handle that :) Tim -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Resolution
Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Martin Magnusson [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, I have written a script that takes an uploaded jpeg-image and places it in a PDF-file with the PDFLib functions in php. The original image file is 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop requires at least 200 dpi. The format of the printed image should be A6 (15,2x10,9 cm). Is it possible to change resolution like this? Thanks // Martin M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Resolution
DvDmanDT wrote: Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. In my experience, the libPDF just embeds the full picture in the document, and lets the printer/renderer worry about the dpi... So if you put a 300-dpi image in a PDF (72-dpi) scaled at 1.0 and print it, the image still comes out 300-dpi. If you scale the image to 2.0, you get a 150-dpi image (or whatever it works out to) to get that image in that much space. There may be ways to change this, or maybe I was mis-interpreting what I saw in my PDFs on my printer, but that's what it seemed like to me. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image Resolution
Hmm.. If PDFs are always 72dpi.. Then the OP would in other words need to resize the PDF document (and everything on it) to 200/72 times the normal size, and then the printer would print it correct? Hmm.. Isn't that pretty much exactly what Richard Lynch said? Seems like a kinda ugly solution to me, but it might be the way to go.. :p -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Richard Lynch [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] DvDmanDT wrote: Take a quick look at imagecopyresampled.. It can change the size of an image pretty good.. Now I know nothing about PDFs really.. But I suppose you could just scale it with the GD functions then place the result in a PDF.. Maybe the PDF functions can scale as well though.. Although, try both, because chances are the PDF functions will resize instead of resample, and resampling gives a MUCH nicer result in most cases.. In my experience, the libPDF just embeds the full picture in the document, and lets the printer/renderer worry about the dpi... So if you put a 300-dpi image in a PDF (72-dpi) scaled at 1.0 and print it, the image still comes out 300-dpi. If you scale the image to 2.0, you get a 150-dpi image (or whatever it works out to) to get that image in that much space. There may be ways to change this, or maybe I was mis-interpreting what I saw in my PDFs on my printer, but that's what it seemed like to me. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image uploads - part 2
Jaskirat Singh wrote: Thanks Robby Russell, Jason Wong , Greg Donald, raditha dissanayak and every one else who answered part 1 of my email concerning image uploads. It was about where to store images uploaded by website users and question was database vs filesystem and dedicated vs shared hosting and the conclusion I could understand was fast,secure,cheap pick any two 1) database + shared = secure and cheap 2) filesystem + shared = fast and cheap 3) filesystem + dedicated = fast and secure 4) database + dedicated = err.. stupid? ;) For now I have decided to try option 1 and see how far I can go till performance begins to become a limiting factor and then decide later if I really need to, to choose between security and cost. I have another question. I have used mysql mediumblob to store images. They are jpeg files. When I retrieve that binary data with a query and generate an image with PHP .. ie. I do ? ... header('Content-type: image/jpeg'); echo $binary_data; ? The image gets generated and displayed OK. But when I save that image file on my work station it gets saved as a huge file .. a file which was 36 Kb jpg when uploaded is saved as 5Mb bmp when downloaded. The data in mysql column is 36 Kb only. So why is it getting saved as such a huge file and why bmp when header is 'image/jpeg' *sighs* IE thanks Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image files - upload and managment
Robby Russell wrote: I tend to stick as much in the database with strict restraints. I know that in my database, an image cannot be deleted unless several rules are met. In the filesystem, a number of things could accidently delete the wrong file. I treat my images as another piece of data and that data is kept there by constraints. If you don't feel you can protect your filesystem from accidental deletions, are the images *really* any safer stored in a database which obviously will use the filesystem as storage? /Per -- Per Jessen, Zurich Let your spam stop here -- http://www.spamchek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: image size?
-Original Message- Let me explain more fully: I call a script like this: img src=image.php?file=file_name_here.jpg The script figures out if the image named in $_GET['file'] is portrait or landscape, and creates a thumbnail of the same orientation. I would like to get the x and y values of the image out of this script somehow, so that I can specify the height and width attributes. However, calling imagecreatefromjpeg(image.php?file=file_name_here.jpg returns an error that it can't open the stream. That function needs the full path to the image. The full path can be a URL or it can be a file path. If you want it to access a URL, the URL needs to be fully formed - ie. Including the http://. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: image size?
What if the values for x and y are not known? I have a function that returns a thumbnail of a larger image; it calculates the size of the created image based on the dimensions of the original. Paul Birnstihl wrote: Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: image size?
I think you'll have to use the imagex and imagey functions to get the dimensions of the thumbnail in order to calculate the size. -Original Message- What if the values for x and y are not known? I have a function that returns a thumbnail of a larger image; it calculates the size of the created image based on the dimensions of the original. Paul Birnstihl wrote: Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? -- 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
Re: [PHP] Re: image size?
Let me explain more fully: I call a script like this: img src=image.php?file=file_name_here.jpg The script figures out if the image named in $_GET['file'] is portrait or landscape, and creates a thumbnail of the same orientation. I would like to get the x and y values of the image out of this script somehow, so that I can specify the height and width attributes. However, calling imagecreatefromjpeg(image.php?file=file_name_here.jpg returns an error that it can't open the stream. The browser displays the thumbnail fine, but I can't figure out a way to read off the size of the image. Any thoughts? Ed Lazor wrote: I think you'll have to use the imagex and imagey functions to get the dimensions of the thumbnail in order to calculate the size. -Original Message- What if the values for x and y are not known? I have a function that returns a thumbnail of a larger image; it calculates the size of the created image based on the dimensions of the original. Paul Birnstihl wrote: Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? -- 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] Re: image size?
Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: image size?
-Original Message- Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? What's the default color depth? -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: image size?
Ed Lazor wrote: -Original Message- Ed Lazor wrote: Is there a way to get the size of an image created using the imagecreate function? I'm guessing it would be xsize x ysize x colour depth = size in bits ? What's the default color depth? -Ed It looks to me like it's 8bit for imagecreate and maybe 24bit for imagecreatetruecolor ? Does anyone else know about this for certain ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Width Error
Jed R. Brubaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all! I am trying to do something really simple, but my error is outside of my expertise (hopefully not for long!). Code: - $this-lVertical = images/box/.$template._lVertical.gif; $borderWidth = imagesx($this-lVertical); - Error: - Fatal error: Call to undefined function imagesx() in c:\web\www\php\classes\Box.class on line 65 --- Am I missing something in the PHP config? What should I be looking for. Oh! I am on PHP5.0 - that should help. Thanks in advance! Read the manual: http://de.php.net/manual/en/function.imagesx.php You need an image resource to get the file size. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Width Error
Apologies. I need to be using getimagesize(). I thought it was only for file sizes. Torsten Roehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jed R. Brubaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all! I am trying to do something really simple, but my error is outside of my expertise (hopefully not for long!). Code: - $this-lVertical = images/box/.$template._lVertical.gif; $borderWidth = imagesx($this-lVertical); - Error: - Fatal error: Call to undefined function imagesx() in c:\web\www\php\classes\Box.class on line 65 --- Am I missing something in the PHP config? What should I be looking for. Oh! I am on PHP5.0 - that should help. Thanks in advance! Read the manual: http://de.php.net/manual/en/function.imagesx.php You need an image resource to get the file size. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image and variable
Try this: ?php $myimage = http://pear.php.net/gifs/pearsmall.gif;; echo 'img src=$myimage'; ? Probably you are not initializing the $myimage var. To see if the html generated is ok, you can use your browser view source capability. Henri marc wrote: Hello, I would like to use a variable instead of an image file name in a html page with this instruction: ?php echo 'img src=$myimage'; ? I tried but the image doesn't show up. Is it impossible or do I do something wrong? My goal is to have a random image print in the page, that's why I want to use a variable. Thank you for your good advices. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Crez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arriv ! Dcouvrez toutes les nouveauts pour dialoguer instantanment avec vos amis. A tlcharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image and variable
Henri marc [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I would like to use a variable instead of an image file name in a html page with this instruction: ?php echo 'img src=$myimage'; ? I tried but the image doesn't show up. Is it impossible or do I do something wrong? My goal is to have a random image print in the page, that's why I want to use a variable. Thank you for your good advices. Variables in single-quoted strings are not evaluated. Either user double quotes or concatination: echo img src=\$myimage\; or echo 'img src=' . $myimage . ''; Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image and variable
$myimage = 'hi.gif'; echo img src='$myimage'; Henri marc wrote: Hello, I would like to use a variable instead of an image file name in a html page with this instruction: ?php echo 'img src=$myimage'; ? I tried but the image doesn't show up. Is it impossible or do I do something wrong? My goal is to have a random image print in the page, that's why I want to use a variable. Thank you for your good advices. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Crez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arriv ! Dcouvrez toutes les nouveauts pour dialoguer instantanment avec vos amis. A tlcharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image and variable
Hello, Variables in single-quoted strings are not evaluated. Either user double quotes or concatination: Thank you very much all for your help, specially Kevin Waterson for his complete program. It was simple, I always make some mistakes with those quotes :-( Another problem still related to those images. I have done that just as a test. Its' very simple but I really don't know why, the result is always the same picture. ?php $random=MT_RAND(1,2); echo $randombr; if ($random=1) { $image='pic.gif'; } if ($random=2) { $image='pic2.gif'; } echo $image; echo img src='$image'; ? Before I used 'if... else' but it wasn't working so I made a test with a second 'if'. I print the result of the variable to be sure that the number is really different, but anyway the picture is always the same. Why, why, why? Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Image and variable
On 10 August 2004 15:55, Henri Marc wrote: Hello, Variables in single-quoted strings are not evaluated. Either user double quotes or concatination: Thank you very much all for your help, specially Kevin Waterson for his complete program. It was simple, I always make some mistakes with those quotes :-( Another problem still related to those images. I have done that just as a test. Its' very simple but I really don't know why, the result is always the same picture. ?php $random=MT_RAND(1,2); echo $randombr; if ($random=1) { You mean == (comparison) not = (assignment). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image and variable
On Tuesday 10 August 2004 22:54, Henri Marc wrote: Variables in single-quoted strings are not evaluated. Either user double quotes or concatination: Thank you very much all for your help, specially Kevin Waterson for his complete program. It was simple, I always make some mistakes with those quotes :-( That's why view (HTML) source should be part of your debugging procedure. Another problem still related to those images. You should always start a new thread when asking about something different. I have done that just as a test. Its' very simple but I really don't know why, the result is always the same picture. ?php $random=MT_RAND(1,2); echo $randombr; if ($random=1) { Because you're assigning the value 1 to the variable $random. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Small change can often be found under seat cushions. -- One of Lazarus Long's most penetrating insights */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image support
RTFM Gus wrote: I have PHP 4.3.6 I want to add image support to manipulate JPEGs. I downloaded http://www.boutell.com/gd but what I do next? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image support
I don't understand, but thanks for answering. Red Wingate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] RTFM Gus wrote: I have PHP 4.3.6 I want to add image support to manipulate JPEGs. I downloaded http://www.boutell.com/gd but what I do next? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image support
Read The F***ing Manual. El lun, 28-06-2004 a las 17:23, Gus escribió: I don't understand, but thanks for answering. Red Wingate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] RTFM Gus wrote: I have PHP 4.3.6 I want to add image support to manipulate JPEGs. I downloaded http://www.boutell.com/gd but what I do next? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image support
It means read the * manual. See http://info.astrian.net/jargon/ for definitions of internet lingo. On Mon, 28 Jun 2004 19:23:01 -0300, Gus [EMAIL PROTECTED] wrote: I don't understand, but thanks for answering. Red Wingate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] RTFM Gus wrote: I have PHP 4.3.6 I want to add image support to manipulate JPEGs. I downloaded http://www.boutell.com/gd but what I do next? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40e09731205995239491481! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image support
I had read it. I didn't understand. So I asked. Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It means read the * manual. See http://info.astrian.net/jargon/ for definitions of internet lingo. On Mon, 28 Jun 2004 19:23:01 -0300, Gus [EMAIL PROTECTED] wrote: I don't understand, but thanks for answering. Red Wingate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] RTFM Gus wrote: I have PHP 4.3.6 I want to add image support to manipulate JPEGs. I downloaded http://www.boutell.com/gd but what I do next? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40e09731205995239491481! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image support
Gus wrote: I had read it. I didn't understand. So I asked. Justin Patrin [EMAIL PROTECTED] wrote in message Not sure if you read the same manual the rest of us did. The manual that these guys refer to have a very nice step by step guide to installing the jpeg extension for GD. Well to be precise the guide lines are in the user contributed notes to the manual, you might have missed those. Fair enough. but i am sure if you look through them closely you will find that most eventualities have been discussed. -- Raditha Dissanayake. - http://www.raditha.com/megaupload/upload.php Sneak past the PHP file upload limits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image resize problems
Edward Peloke wrote: I have looked at several of the functions and tried a few tutorials online but am not having much luck for some reason resizing images. I have this code which works fine but everytime I try to add some resizing code, I get the error that the image is not a valid image resource. I have even hardcoded the values to an image I know exists and get the same error. I would like to resize the images on upload to 250 wide but nothing seems to work. $upload_dir = ../images/property_$id; //When REGISTERED_GLOBALS are off in php.ini $_POST= $HTTP_POST_VARS; $_GET = $HTTP_GET_VARS; //Upload the file if($_GET['method'] == upload) { $file_array = $HTTP_POST_FILES['file']; $_SESSION['message'] = ; $uploads = false; for($i = 0 ; $i $files_to_upload; $i++) { if($_FILES['file']['name'][$i]) { $uploads = true; if($_FILES['file']['name'][$i]) { $file_to_upload = $upload_dir./.$_FILES['file']['name'][$i]; $thisName=$_FILES['file']['name'][$i]; $sql-query(update properties set main_thumb='$thisName' where id=$id and main_thumb is null); move_uploaded_file($_FILES['file']['tmp_name'][$i],$file_to_upload); chmod($file_to_upload,0777); // add image resize $_SESSION['message'] .= $_FILES['file']['name'][$i]. uploaded.br; } } } if(!$uploads) $_SESSION['message'] = No files selected!; } Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. Here's some code I use: $fileinfo = pathinfo($file); switch(strtolower($fileinfo['extension'])) { case 'png': $ifh = imagecreatefrompng($dir.$file); break; case 'jpg': case 'jpeg': case 'jpe': $ifh = imagecreatefromjpeg($dir.$file); break; case 'gif': $ifh = imagecreatefromgif($dir.$file); break; default: echo ' I don\'t know what to do with the extension '.$fileinfo['extension'].\n; exit; break; } $swidth = imagesx($ifh); $sheight = imagesy($ifh); $ih = imagecreatetruecolor($width + $edge * 2, $height + $edge * 2); imagealphablending($ih, true); if($swidth $sheight) { $nwidth = $width; $nheight = (int)($sheight / $swidth * $nwidth); $x = 0; $y = ($height - $nheight) / 2; } else if($sheight $swidth) { $nheight = $height; $nwidth = (int)($swidth / $sheight * $nheight); $y = 0; $x = ($width - $nwidth) / 2; } else { $nwidth = $width; $nheight = $height; $x = $y = 0; } imagecopyresampled($ih, $ifh, $x + $edge, $y + $edge, 0, 0, $nwidth, $nheight, $swidth, $sheight); header('Content-Type: image/jpeg'); imagejpeg($ih); -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Alpha - Water Mark
Anderson Ouriques [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I would like how use the image functions to put one water-mark in other image. I can't use with alpha functions. I use PNG format. Maybe this is what you're looking for: http://phparch.com/news/1242 Regards, Torsten -- Atenciosamente, Anderson Ouriques Pesquisa e Desenvolvimento Mundopixel Internet t: 48 2362364 c: 48 99074190 e: [EMAIL PROTECTED] w: www.mundopixel.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image header problem
Qt wrote: Dear Sirs, When I am using following codes, I am gettinh Cannot modify header information - headers already sent by error. What should I do? header (Content-type: image/png); $im = @imagecreate (50, 100) or die (Cannot Initialize new GD image stream); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 233, 14, 91); imagestring ($im, 1, 5, 5, A Simple Text String, $text_color); imagepng ($im); This has to do with what is above this code. Somewhere before this, some output is happening, through an echo or a print or ? ?php. Check the rest of your code for those. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image resize on upload
I'll second that one, I wrote a shell script in PHP to resize images, using ImageMagicks mogrify command, and it took ages. It's really much too slow for a web site. If you need a faster solution, I think you have to buy something. On 26 Feb 2004, at 09:15, Adam Bregenzer wrote: On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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
Re: [PHP] Re: Image resize on upload
On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image resize on upload
gd seems to work fine ? even nconvert via command line does a good job and it resizes gif too I'll second that one, I wrote a shell script in PHP to resize images, using ImageMagicks mogrify command, and it took ages. It's really much too slow for a web site. If you need a faster solution, I think you have to buy something. On 26 Feb 2004, at 09:15, Adam Bregenzer wrote: On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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
Re: [PHP] Re: Image resize on upload
Thanks!! I found some documentation on the GD library. I most likely be posting again!! :) ~WILL~ [EMAIL PROTECTED] wrote: gd seems to work fine ? even nconvert via command line does a good job and it resizes gif too I'll second that one, I wrote a shell script in PHP to resize images, using ImageMagicks mogrify command, and it took ages. It's really much too slow for a web site. If you need a faster solution, I think you have to buy something. On 26 Feb 2004, at 09:15, Adam Bregenzer wrote: On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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
Re: [PHP] Re: Image resize on upload
Make sure you use imagecreatetruecolor() with GD when resizing images or you'll get some undesirable results. Imagemagick's convert and mogrify worked well for me although I was resizing an uploaded image. Ed Curtis On Thu, 26 Feb 2004, Will wrote: Thanks!! I found some documentation on the GD library. I most likely be posting again!! :) ~WILL~ [EMAIL PROTECTED] wrote: gd seems to work fine ? even nconvert via command line does a good job and it resizes gif too I'll second that one, I wrote a shell script in PHP to resize images, using ImageMagicks mogrify command, and it took ages. It's really much too slow for a web site. If you need a faster solution, I think you have to buy something. On 26 Feb 2004, at 09:15, Adam Bregenzer wrote: On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image resize on upload
Thanks everyone. I got GD2 to work quite well! The thumb look pretty good. ~WILL~ Ed Curtis wrote: Make sure you use imagecreatetruecolor() with GD when resizing images or you'll get some undesirable results. Imagemagick's convert and mogrify worked well for me although I was resizing an uploaded image. Ed Curtis On Thu, 26 Feb 2004, Will wrote: Thanks!! I found some documentation on the GD library. I most likely be posting again!! :) ~WILL~ [EMAIL PROTECTED] wrote: gd seems to work fine ? even nconvert via command line does a good job and it resizes gif too I'll second that one, I wrote a shell script in PHP to resize images, using ImageMagicks mogrify command, and it took ages. It's really much too slow for a web site. If you need a faster solution, I think you have to buy something. On 26 Feb 2004, at 09:15, Adam Bregenzer wrote: On Thu, 2004-02-26 at 02:25, Will wrote: I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? I use ImageMagick's[1] convert[2] to do this. It is not a PHP module and must be run through exec[3]. Also, in my experience image manipulation is rather time consuming, it is a good idea to cache altered images so they do not have to be recreated on every page load. [1] http://www.imagemagick.org/ [2] http://www.imagemagick.org/www/convert.html [3] http://www.php.net/exec -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image resize on upload
I forgot to mention what I was trying to do. There is a web page that pulls the image file name from the database then reads the URL to the directory where the image is. Is it possible to just resize it when the web page is brought up in the browser? Like I said I am not sure which one to use. ~WILL~ Will wrote: Hello all, I looked at the PHP manual and found a lot of things to do with images but I did not seem to find out how to resize an image on upload. Can anyone help?? Thanks in advance, ~WILL~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Quality Depreciation with GD
Jough P wrote: Greetings, all. I'm trying to upload and crop an image. I'm not able to do it without the quality of the image suffering. I've fiddled with the quality parameter in the imagejpeg function but it seems to have no effect. I've tried varying values and leaving the parameter out altogether. Any pearls of wisdom out there? Try using png maybe? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Header Problems
Bob Eldred wrote: I'm wanting to serve images outside the docroot of apache, so that the images can't be so easily hijacked. However, I appear to be running into a problem with (I think) the headers not being sent properly. IE (v6) will only save the images as BMPs, not as JPGs, even though they are JPG images. Given that your purpose is for the images to be difficult to hijack, doesn't this serve your interest? :) The problem with IE is that it's developed by Microsoft. The same way Microsoft didn't recognize magic for detecting the file type (and used extensions instead), it now doesn't use MIME types (and uses extensions instead). Never tried it, but I would assume that serving an image along with the proper headers and with a .txt extension to IE will result in saving it as text. So basically it's an IE thing. What you can do, if you really need to, is serve the images as img src=/showpicture/xx.jpg and parse the xx out of it in showpicture.php. HTH Bogdan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Magick
Mike At Spy wrote: Anyone here familiar with the installation of Image Magick and what files it installs on your machine? I had an admin put it on, and then took it off - but took it off by removing what she thought were all of the files related to it. I just found some files I think that are. They are located in the usr/local/bin directory and are called: animate composite convert display identify mogrify montage The date/time of the files being put there seems to correspond with when the admin put the program on, and names of the files seem to imply it to me. And I just wanted to make sure I'm not going to screw up something else by removing them. :) Thanks! the easiest way to remove them is to use RPM, if that was what was used to install them rpm -e ImageMagick if there are no dependency problems, then it will go ahead. make sure that you don't have any libraries that use it! I use ImageMagick in a PHP image-upload function that resizes to a maximum size. The RPM program would not tell you of that dependency. Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Verification (On Submit)
Hello, On 07/02/2003 12:00 AM, Joel Louie M Miranda wrote: Can someone give me a suggestion or a howto where could I get some idea on how to do image verification? Like on yahoo.com signup where you need to enter the text on the image to process your order. This class does what you want: Class: CAPTCHA http://www.phpclasses.org/captcha -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image
Try to put your image into your web directory Diksha Neel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] dear all, hi! i am creating an html file through a php script. i am drawing a table in one of whose cells i want to include and image. but this image does not appear when i open the html page in internet explorer. i think the syntax is correct and the picture is very much present in the given destination. what can be the problem? thanks, diksha. table border=1 width=100% height=430 tr td width=100% colspan=2 height=61img src=C:\Documents and Settings\mangesh\My Documents\My Pictures\sample.jpgdiv align=centerh1u'; $string.=$wname; $string.='/u/h1/div/td /tr ___ Odomos - the only mosquito protection outside 4 walls - Click here to know more! http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htmodomosw n -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Resize
You will need the GD library of image functions for this to work. You can find more information at the following page: http://www.php.net/manual/en/ref.image.php gl Randum Ian [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Hi guys, Is it possible to resize an uploaded file to 10% of it's size and rename it accordingly? I have the filename for the full-size image as filename-WWWxHHH.jpg where WWW is the width and HHH is the height. I want the re-sized image to have the filename filename-thumb-WWWxHHH.jpg where WWW is the resized width and HHH is the resized height. Does this make any sense, would it be possible automatically? I am grateful for any help, Ian. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image resizing
What platform are you running PHP on? Shaun wrote: Hi, My webserver doesn't have the GD library installed, please can someone tell me how I can resize uploaded images for thumbnails? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: image generation with PHP
Hello, Myrage wrote: No luck I have installed GD lib and zlib and all into c:\php\extensions bur i still get an error *Fatal error*: Call to undefined function: imagecreate() in *c:\inetpub\wwwroot\image.php* on line *24* Run phpinfo() and check again (under GD). See if you can find some hints... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
I did this just today -- http://www.php.net/manual/en/function.imagecreate.php Its real short and sweet. If you're running on Linux, I'm sure you'll be able to get it to work just fine - on Windows, make sure you have the gd extention, and that it will be loaded with php.ini. Hope this helps! -Jason Myrage wrote: is it possible to generate images with texts automatically?? like for eg. if the text is 7555 then automatically an image is generated with the text 7555 in it any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
i am using windows and I cannot seem to find the necessary libs and dlls Jason Young [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I did this just today -- http://www.php.net/manual/en/function.imagecreate.php Its real short and sweet. If you're running on Linux, I'm sure you'll be able to get it to work just fine - on Windows, make sure you have the gd extention, and that it will be loaded with php.ini. Hope this helps! -Jason Myrage wrote: is it possible to generate images with texts automatically?? like for eg. if the text is 7555 then automatically an image is generated with the text 7555 in it any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
You'll need the full PHP package (the 5 MB zip file, not the 400k quickie) .. it'll be in the extensions/ directory of there.. php_gd.dll.. Myrage wrote: i am using windows and I cannot seem to find the necessary libs and dlls Jason Young wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I did this just today -- http://www.php.net/manual/en/function.imagecreate.php Its real short and sweet. If you're running on Linux, I'm sure you'll be able to get it to work just fine - on Windows, make sure you have the gd extention, and that it will be loaded with php.ini. Hope this helps! -Jason Myrage wrote: is it possible to generate images with texts automatically?? like for eg. if the text is 7555 then automatically an image is generated with the text 7555 in it any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
No luck I have installed GD lib and zlib and all into c:\php\extensions bur i still get an error br / bFatal error/b: Call to undefined function: imagecreate() in bc:\inetpub\wwwroot\image.php/b on line b24/bbr / image.php code :? /* Header( Content-type: image/jpeg); */Header( Content-type: image/gif);/* create image */$image = imagecreate(200,200); /* create color R=100, G=0, R=0 */$maroon = ImageColorAllocate($image,100,0,0); /* create color R=255, G=255, R=255 */$white = ImageColorAllocate($image,255,255,255); /* create color green */$green = ImageColorAllocate($image,0,100,0); /* create white background*/ImageFilledRectangle($image,0,0,200,200,$white); /* create frame*/ImageRectangle($image,10,10,190,190,$maroon); /* create inner rectangle*/ImageFilledRectangle($image,50,70,150,150,$maroon); /* display 5 fonts */for ($i=1; $i = 5; $i++) ImageString($image,$i,15,$i*10,'php.weblogs.com',$green); /* render image *//* ImageJPEG($image); */ImageGIF($image);/*cleanup memory */ImageDestroy($image); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation with PHP
Did you tell php.ini to load this extension, and then restart your webserver? (I am taking it that you're using IIS or PWS? -- Someone else will have to field the question on whether or not GD/PHP works with this.. I would imagine so, but I am not sure enough to put any money on it :) ) Myrage wrote: No luck I have installed GD lib and zlib and all into c:\php\extensions bur i still get an error *Fatal error*: Call to undefined function: imagecreate() in *c:\inetpub\wwwroot\image.php* on line *24* image.php code : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image from MIME email
Christoph wrote: Hello, I'm currently programming a webmail interface with php 4.1.2 and c-client 2001. I'm getting the Mime data from the mail. Now I have the image data as text but how I can get it into an img field? At first, you'll have to convert the data back to binary using the encoding specified in the header (of that MIME part). Then you'll have to save the image to the disk (or to a database), after which you can use the img tag. Be sure to give the filename the correct extension (which you can gain using the content-type, also specified in the header of that MIME-part). Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image viewing in the mail client
Hello, On 09/30/2002 11:18 AM, Ramesh Nagendra Pillai wrote: I have developed an application to send newsletter periodically using simple mail function in PHP, the newsletter is in HTML format and also have some images. The problem is when we see the newsletter in the inbox, images are not coming. So I added base reference to image, its working fine but if we are viewing it any mail client image is not coming. Please any one tell me how to overcome this problem. I tried to attach images in the headers, its not working Can anyone please help me out You'd better embed the images in the message itself. In that case you may want to try this class that can do that for you easily: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image wrapper - graphs
Does anyone know of image creation libraries that will generate graphs? http://www.aditus.nu/jpgraph/ Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image resolution and php
I need to get resolution information (dpi) from any image of jpg, gif or png formats. It would be sufficient to obtain pixel and inches dimension of such images and calculate resolution by simply dividing but I haven't found any function that gets effective dimensions in inches. http://www.php.net/manual/en/function.getimagesize.php I'm sligthly confused about what you're looking for, but the above URL *could* be something. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Image resolution and php
Images don't have a resolution per se; display devices have a resolution. Images (the formats you're talking about, anyway) are measured in pixel width and height. The height and width in any units other than pixels of course necessitates conversion - for an easy example, a 300x300 image on a 1200x1200dpi printer will be exactly one quarter the size of the same image printed on a 300x300 dpi printer. -Original Message- From: Jome [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 8:11 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Image resolution and php I need to get resolution information (dpi) from any image of jpg, gif or png formats. It would be sufficient to obtain pixel and inches dimension of such images and calculate resolution by simply dividing but I haven't found any function that gets effective dimensions in inches. http://www.php.net/manual/en/function.getimagesize.php I'm sligthly confused about what you're looking for, but the above URL *could* be something. Jome -- 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
Re: [PHP] Re: Image resolution and php
I believe that image files on the Mac platform contain metadata that does in fact include this information. Sherlock on Mac OS 9 is not capable of finding this information. However, I did find the following information for Adobe Photoshop 7 for Mac OS X on how you can achieve this. I don't know if Adobe Photoshop 7 for Windows can do this. From: http://www.apple.com/macosx/applications/photoshop/ You have thousands of digital pictures and graphics stored on your hard disk. Wouldn¹t it be cool to be able to verify what¹s in an image file before you click on it? Adobe thought so too, which is why the new File Browser in Photoshop 7.0 lets you do just that. The File Browser lets you view your thumbnails and image metadata like color profile, date modified, and the Exchangeable Image File (EXIF) information generated by digital cameras to make sure the images are what you¹re looking for before you open them. As an added convenience, Photoshop lets you add ranking to your file criteria. You can have your own ranking system for identifying images with, for example, rankings such as ³Proof² and ³Final.² You can also sort images by file name, file width and height, file size, file type, resolution, color profile, date created, date modified and copyright. The File Browser also gives you the added advantage of being able to search for images visually rather than just by file name. Eric C. Pollitt, Founder 401 E. Illinois Ave. Peoria, IL 61603 Global Hemp - Portal to the hemp community http://www.globalhemp.com/ Prohibition will work great injury to the cause of temperance. It is a species of intemperance within itself, for it goes beyond the bounds of reason in that it attempts to control a man's appetite by legislation, and makes a crime out of things that are not crimes. A Prohibition law strikes a blow at the very principles upon which our government was founded. Abraham Lincoln in a speech to the Illinois House of Representatives on December 18, 1840. From: Jome [EMAIL PROTECTED] Date: Wed, 18 Sep 2002 14:10:58 +0200 To: [EMAIL PROTECTED] Subject: [PHP] Re: Image resolution and php I need to get resolution information (dpi) from any image of jpg, gif or png formats. It would be sufficient to obtain pixel and inches dimension of such images and calculate resolution by simply dividing but I haven't found any function that gets effective dimensions in inches. http://www.php.net/manual/en/function.getimagesize.php I'm sligthly confused about what you're looking for, but the above URL *could* be something. Jome -- 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] Re: image manipulation
Here is the list of the PHP's images functions: http://www.php.net/manual/en/ref.image.php You can look at filesize and getimagesize for the size / height width. For the second question, I dont know look at the list. -- Merci de nous avoir choisi. - Thanks you for your choice. Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] [EMAIL PROTECTED] www.GroupAKT.com - Hébergement Group. www.WorldAKT.com - Hébergement de sites Internet Tux [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hey all, I was just wondering if anyone could recommend any tutorials or books or functions i should look into, to do the following: - decrease the size(kilobytes wise not height/width) of an image - imprint a transparent logo onto every picture displayed any feedback greatly appreciated. jo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image library
The answer I would give at this moment would be a variant of your A) version where the hash directories would further contain directories limited to, say 300 images. Found it out after a painfully slow experience with MySQL blobs. I did not however implement this solution yet (still using the blobs due to lack of time), so I can't give you an actual comparison (hence the format of my first sentence). HTH Bogdan Scott Houseman wrote: Hi there. Which way would be the most efficient/fastest to access images from an image library. A) Store image files in a hash directory structure AND storing each file's information in a mysql table OR B) Storing image information in mysql table AND storing the image in a BLOB field in that table. The way I see it, considerations to be taken into acount: - Is it quicker/better to retrieve image from table then stream out to browser OR simply direct the browser to the file? i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG SRC=/imagelib/5/f/10 - Will a database OR filesystem be more scalable i.e. which wil perform better when there are 1 images in the libary? Thanks in advance Regards -Scott -- Scott Houseman Jam Warehouse http://www.jamwarehouse.com/ Smart Business Innovation +27 21 4477440 / +27 82 4918021 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image library
Lots of good ideas. One other thing to consider when designing this is the possibility of multiple web server accessing a single database server. If you use the file system method which assumes that the web/db are on the same server as soon as you want to have multiple web servers you'll run into problems. Of course you also probably don't want to have multiple web servers ask a single db server over and over for the same image. Especially if mysql's blobs are inefficient (I don't know if they are or not). You might consider storing the images in the database, and then setting it up so that it first checks the filesystem and if it isn't there, gets it from the database and caches it to the filesystem so the next access it fast. This would allow you to run multiple web servers since they could both cache them locally. For what it's worth, for our application we use a two level directory heirarchy of [0-9]/[0-9]/primary_id.jpg. Works well for us. -philip On Wed, 21 Aug 2002, Scott Houseman wrote: Hi there. Which way would be the most efficient/fastest to access images from an image library. A) Store image files in a hash directory structure AND storing each file's information in a mysql table OR B) Storing image information in mysql table AND storing the image in a BLOB field in that table. The way I see it, considerations to be taken into acount: - Is it quicker/better to retrieve image from table then stream out to browser OR simply direct the browser to the file? i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG SRC=/imagelib/5/f/10 - Will a database OR filesystem be more scalable i.e. which wil perform better when there are 1 images in the libary? Thanks in advance Regards -Scott -- Scott Houseman Jam Warehouse http://www.jamwarehouse.com/ Smart Business Innovation +27 21 4477440 / +27 82 4918021 -- 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] RE: Image library
[snip] Having a large number of files in a single directory does affect performance, the degree of which depends on the filesystem. This is generally accepted wisdom for dealing with large numbers of files - but what number is considered large? Any rules of thumb, for different OpSys/file systems? [/snip] I guess the situation I have had (various OS's) and numbers of items in the file(s) (upwards of 40k items) I have never encountered a degredation in performance that could be deemed noticeable. I could perform some file retrieval analysis to see time lags, and I am sure that there would be some dependent upon the file system (and OS), not to mention hardware factors, the most significant which comes to mind is hard-drive seek times. But as yet, none noticed... You could probably find info on this if you dug around in the linux/freebsd source code... I think more important than how many files can you fit in one directory before things start to suck is the issue of that directory getting big enough (kilobyte wise) that it fills up the partition. If you put them in separate directories to start out with you can always add a new disk (fileserver, etc.) and put half of the directories on the new disk, mounted in the same place. This way your code doesn't need to change at all. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image functions
You won't get very far if you aren't outputting an image to the browser using ImageJpeg(), etc. Matt Matthew J Gray UWRF - Information Technology Services [EMAIL PROTECTED] Gerard Samuel wrote: Im trying to modify a poll script to not use the hard coded image files and use php's image functions. On the file that will be outputing the poll graphics, I tried at the top of the page - header(Content-type: image/png); and header(Content-type: image/jpeg); For some reason, when the page is viewed, the only thing that gets output to the browser is the url of the page I tried using one of the examples on php.net image create routines and its still doing the same thing.. Here is a snip ?php /* * THIS HAS TO GO HERE FOR THE IMAGE BARS */ header(Content-type: image/jpeg); $pollID = $HTTP_POST_VARS['pollID']; $voteID = $HTTP_POST_VARS['voteID']; --snip- If I comment out the header call, Im back to normal... Im running PHP 4.1.2 with GD support Any thoughts Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IMAGE Manipulation
Hi Dani, I'm trying to resize images from a big image to smaller image in dimension and also file size so that when a user upload an image into server, when a browser display the picture it desn't have to be as big. I hope my question make sense. a good way for working with images is using the gd-library. Just look at http://www.boutell.com/gd/. Ther's a possibility to download the extension and there are some introductions too. I hope this helps Bye, Marcel -- registered Fli4l-User #0388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image generation issues
In article 00ce01c1b36b$46c0d640$02646464@ade, [EMAIL PROTECTED] says... Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt= I think you will find that the font path in ImageTTFText needs to be an absolute path, or relative to the current working directory. It certainly isn't relative to the web root. To be absolutely certain, especially if you are likely to call this from anywhere in your web file structure, make the path absolute! -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Fields and PHP...
Hi again, I guess one really good reason for not storing images directly in a db table is performance. When you store a blob in a table it affects the whole database's performance. It slows it down, that's why the most common method is to store the images in a dir on the webserver and store only the path to the image in the databse field. That code I posted in the previous will allow uploading of an image to a directory on the server, store the path to the image in the correct record for retrieval at a later point. It also retrieves an image for a particular record. HTH Joe :) Zara E Gonzalez [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not sure if this is off topic for this list or not, but thought I would try... I have a Linux server running Redhat 7.0, PHP 4.1.1, and freetds 0.53. My Linux server connects to a Win2k server running MSSQL 2000. Everything works wonderfully, except, I have an image field in one of my tables and I can't seem to find a way to pull it out without having PHP completely freak out. (i.e. I get no error message at all just page cannot be displayed) So I'm wondering, can you pull image fields out with PHP? If so, I'm guessing my limitation is freetds. If not, is there any way to pull an image out of a database using php? (i.e. store it in a different type of field not image.) Any help is appreciated, Thanks, Zara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Image Fields and PHP...
Hi Zara, are you storing a path to the images in your db? Or the actual image? It's recommended that you stay away from storing actual images in the db. If you are storing a path the code below might help you out. It select a firstname, and an image according to an id. You'll have to change the youridentityfield and youridentity values to suit your needs. If you are looking for an image upload script # display image from db # #connect to db $connectionToDBid = odbc_connect(ceo34deesnr43ipits, joeyscode, joeyscode); // sql statement $sqlb = SELECT imagepath, firstname FROM IMAGES WHERE youridentityfield = . $youridentity; # execute the query $resultset = odbc_do($connectionToDBid, $sqlb); $image = odbc_result($resultset,1); $firstname = odbc_result($resultset,2); print brbrbrdiv align='center'; print table width='400' border=0 cellpadding=2 ; print trtd align='left' ; print font color='#ff' face='verdana'h4 . Welcome back . $firstname . /h4/font; print /td/tr; print trtd align='center' ; print img src=' . $image.' align='center' border='0'br; print /td/tr; print /table; # close the db connection here # end of display image from db # #photo upload form Here's a common form that allows you to upload a file (say an image) to the db form action='upload.php' method='post' enctype='multipart/form-data' input type='hidden' name='MAX_FILE_SIZE' value='102400' Pfont color='#ff' face='verdana' size=1Upload Photo:/fontinput type='file' name='userfile'input type='submit' value='Upload!!!'/form/p end of photo upload form ## start of upload process to db ?php # $userfile is the file being uploaded # print $userfile . BR; # print $userfile_name . BR; #use a time stamp to uniquely name the image before storing in db to prevent two files with the same name $timestamp = time(); $userfile_name = $timestamp.$userfile_name ; // copy the file being posted -- remember to escape backslashes!!! if(copy($userfile, /ez/codesnipits/consultant/tempimages/. $userfile_name)){ print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399' size='2'Your picture has been uploaded successfully and has been made available for online users to view./fontbrbrbr ; } else { print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399'Error encountered during resume upload process./fontbr; } $patharola = tempimages/. $userfile_name; // insert path into database here # connect to db $connectionToDBid = odbc_connect(cdefc5onwesulertt, joeyscon, joeyscon); session_register(consultantid); $consultantid = $consultantid; # create query statement -- update image field in db using path $sqlr = UPDATE CONSULTANT SET image= '$patharola' WHERE consultantid= . $consultantid; # execute the sql statement (query) on the connection made $resultset = odbc_do($connectionToDBid, $sqlr); ? end of image to db process ## Hope this helps you out :) Cheers Joe :) Zara E Gonzalez [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not sure if this is off topic for this list or not, but thought I would try... I have a Linux server running Redhat 7.0, PHP 4.1.1, and freetds 0.53. My Linux server connects to a Win2k server running MSSQL 2000. Everything works wonderfully, except, I have an image field in one of my tables and I can't seem to find a way to pull it out without having PHP completely freak out. (i.e. I get no error message at all just page cannot be displayed) So I'm wondering, can you pull image fields out with PHP? If so, I'm guessing my limitation is freetds. If not, is there any way to pull an image out of a database using php? (i.e. store it in a different type of field not image.) Any help is appreciated, Thanks, Zara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Image Fields and PHP...
Joe (And/Or others), We are storing the actual images in the DB. We did not want our pictures to be on our webserver. Instead we felt it would be better to keep them on the database server. In order to do this, they had to be stored in the database itself since the database server is not accesible by the web. (I.e. the only way to get stuff off of it via the web is to pull it out through the DB connection) Now, You say that it is not recommended that we store our images in our database, can you give me a reasons why? Thanks, Zara -Original Message- From: Lerp [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 2:17 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Image Fields and PHP... Hi Zara, are you storing a path to the images in your db? Or the actual image? It's recommended that you stay away from storing actual images in the db. If you are storing a path the code below might help you out. It select a firstname, and an image according to an id. You'll have to change the youridentityfield and youridentity values to suit your needs. If you are looking for an image upload script # display image from db # #connect to db $connectionToDBid = odbc_connect(ceo34deesnr43ipits, joeyscode, joeyscode); // sql statement $sqlb = SELECT imagepath, firstname FROM IMAGES WHERE youridentityfield = . $youridentity; # execute the query $resultset = odbc_do($connectionToDBid, $sqlb); $image = odbc_result($resultset,1); $firstname = odbc_result($resultset,2); print brbrbrdiv align='center'; print table width='400' border=0 cellpadding=2 ; print trtd align='left' ; print font color='#ff' face='verdana'h4 . Welcome back . $firstname . /h4/font; print /td/tr; print trtd align='center' ; print img src=' . $image.' align='center' border='0'br; print /td/tr; print /table; # close the db connection here # end of display image from db # #photo upload form Here's a common form that allows you to upload a file (say an image) to the db form action='upload.php' method='post' enctype='multipart/form-data' input type='hidden' name='MAX_FILE_SIZE' value='102400' Pfont color='#ff' face='verdana' size=1Upload Photo:/fontinput type='file' name='userfile'input type='submit' value='Upload!!!'/form/p end of photo upload form ## start of upload process to db ?php # $userfile is the file being uploaded # print $userfile . BR; # print $userfile_name . BR; #use a time stamp to uniquely name the image before storing in db to prevent two files with the same name $timestamp = time(); $userfile_name = $timestamp.$userfile_name ; // copy the file being posted -- remember to escape backslashes!!! if(copy($userfile, /ez/codesnipits/consultant/tempimages/. $userfile_name)){ print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399' size='2'Your picture has been uploaded successfully and has been made available for online users to view./fontbrbrbr ; } else { print font face='Verdana, Arial, Helvetica, sans-serif' color='#663399'Error encountered during resume upload process./fontbr; } $patharola = tempimages/. $userfile_name; // insert path into database here # connect to db $connectionToDBid = odbc_connect(cdefc5onwesulertt, joeyscon, joeyscon); session_register(consultantid); $consultantid = $consultantid; # create query statement -- update image field in db using path $sqlr = UPDATE CONSULTANT SET image= '$patharola' WHERE consultantid= . $consultantid; # execute the sql statement (query) on the connection made $resultset = odbc_do($connectionToDBid, $sqlr); ? end of image to db process ## Hope this helps you out :) Cheers Joe :) Zara E Gonzalez [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not sure if this is off topic for this list or not, but thought I would try... I have a Linux server running Redhat 7.0, PHP 4.1.1, and freetds 0.53. My Linux server connects to a Win2k server running MSSQL 2000. Everything works wonderfully, except, I have an image field in one of my tables and I can't seem to find a way to pull it out without having PHP completely freak out. (i.e. I get no error message at all just page cannot be displayed) So I'm wondering, can you pull image fields out with PHP? If so, I'm guessing my limitation is freetds. If not, is there any way to pull an image out of a database using php? (i.e. store it in a different type of field not image.)
Re: [PHP] Re: Image Fields and PHP...
It basically comes down to speed. While there is nothing Technicaly wrong with storing the images in the database, accessing the images will become slower as the database gets larger, than if the files were stored on the filesystem. Whether or not this degredation of performance is acceptable or not is up to you, but... if you still want to pull an image directly from the database, try the following method. Please note that you must have the image type stored in the database as well. Create a seperate PHP script called getimg.php: /* Begin getpic.php */ ?php if($id) { $dbhost = ; /* MySQL Server */ $dbuser = ; /* MySQL UserName */ $dbpass = ; /* MySQL Password */ $dbname = ; /* MySQL Database */ $db = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname,$db); $query = select image,type from images where id=$id; $result = mysql_query($query); $data = mysql_result($result,0,image); $type = mysql_result($result,0,type); Header( Content-type: $type); echo $data; }; ? /* End getpic.php Now that you have this, when you want to display a picture, call getpic.php in your img tag like so: IMG SRC=getpic.php?id=12 (obviously, this gets the picture with ID 12 from the database. ) There are probably more elegant ways of doing this, but it works. :) - Original Message - From: Gonzalez, Zara E [EMAIL PROTECTED] To: 'Lerp' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 1:52 PM Subject: RE: [PHP] Re: Image Fields and PHP... Joe (And/Or others), We are storing the actual images in the DB. We did not want our pictures to be on our webserver. Instead we felt it would be better to keep them on the database server. In order to do this, they had to be stored in the database itself since the database server is not accesible by the web. (I.e. the only way to get stuff off of it via the web is to pull it out through the DB connection) Now, You say that it is not recommended that we store our images in our database, can you give me a reasons why? Thanks, Zara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Image Fields and PHP...
Actually, I can't do that. Which is the whole problem I'm having. PHP fails when I try to pull the image field out of my database. After talking to others I thought it might be the @@textsize variable in MSSQL unfortunately setting it to a lower value did not solve my problem. I have recently spoken to another person who is having the same problem as I am and it appears to be a problem with one or all of the programs I am using. (MSSQL, PHP, and FreeTDS) I guess I'll have to change how my system is set up after all. -Original Message- From: Jason Bell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 4:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Image Fields and PHP... It basically comes down to speed. While there is nothing Technicaly wrong with storing the images in the database, accessing the images will become slower as the database gets larger, than if the files were stored on the filesystem. Whether or not this degredation of performance is acceptable or not is up to you, but... if you still want to pull an image directly from the database, try the following method. Please note that you must have the image type stored in the database as well. Create a seperate PHP script called getimg.php: /* Begin getpic.php */ ?php if($id) { $dbhost = ; /* MySQL Server */ $dbuser = ; /* MySQL UserName */ $dbpass = ; /* MySQL Password */ $dbname = ; /* MySQL Database */ $db = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname,$db); $query = select image,type from images where id=$id; $result = mysql_query($query); $data = mysql_result($result,0,image); $type = mysql_result($result,0,type); Header( Content-type: $type); echo $data; }; ? /* End getpic.php Now that you have this, when you want to display a picture, call getpic.php in your img tag like so: IMG SRC=getpic.php?id=12 (obviously, this gets the picture with ID 12 from the database. ) There are probably more elegant ways of doing this, but it works. :) - Original Message - From: Gonzalez, Zara E [EMAIL PROTECTED] To: 'Lerp' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 1:52 PM Subject: RE: [PHP] Re: Image Fields and PHP... Joe (And/Or others), We are storing the actual images in the DB. We did not want our pictures to be on our webserver. Instead we felt it would be better to keep them on the database server. In order to do this, they had to be stored in the database itself since the database server is not accesible by the web. (I.e. the only way to get stuff off of it via the web is to pull it out through the DB connection) Now, You say that it is not recommended that we store our images in our database, can you give me a reasons why? Thanks, Zara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Image generation scripts
Terry, Their is a cool class someone has made to make it a snatch to add graphs charts, and so forth. Make a search for google for PHP graph its the first result JPGraph. I highly recommend it for your project. Regards, Yoep Step One [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there! I'm writing some stuff for a non-profit site as voluntary help. Does somebody have any PHP image generation scripts (GD) that could be used to pretty up a statistics page. The produced image should be a chart, pie, bars or something similar that could visually represent various statistical information. It would be great if one could specify background images etc. The image should be a bit more beautiful from the pie chart at http://skydiving-org.freeservers.com/stats.htm A bit more customization and visual attraction would be great. Thanks! Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Image problem
I've instaled and cofigured php4 on WinNT with Apache Web server. I can't use any fuction of Image manipulation, 'cause I get this error message: ImageGif: No GIF support in this PHP build In phpinfo() is listed that: gd lib. enabled, zlib lib. enabled. What do I still miss there? In the newest version of GD library (think it since about 1.3 or something) does support GIF, because GIF is a commerial image format. Use PNG or JPEG instead. That much better, or find a version with GIF support. You can see what Image formats you GD can use by make a file with follow content: ?php phpinfo(); ? :o) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Image problem
Thanks, in phpinfo list really isn't support for GIF:( How can I manipulate jpeg images? Which functions are for this img. format? P. |+- || Johan [EMAIL PROTECTED] | || Odoslané kým: | || php-general-return-77040-lalkap=emo.seas.sk@lis| || ts.php.net | || | || | || 07.12.2001 14:30 | || | |+- ---| | | | Komu: [EMAIL PROTECTED] | | Kópia: | | Predmet:[PHP] Re: Image problem | ---| I've instaled and cofigured php4 on WinNT with Apache Web server. I can't use any fuction of Image manipulation, 'cause I get this error message: ImageGif: No GIF support in this PHP build In phpinfo() is listed that: gd lib. enabled, zlib lib. enabled. What do I still miss there? In the newest version of GD library (think it since about 1.3 or something) does support GIF, because GIF is a commerial image format. Use PNG or JPEG instead. That much better, or find a version with GIF support. You can see what Image formats you GD can use by make a file with follow content: ?php phpinfo(); ? :o) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] [ Re: [PHP] Re: Image problem]
Original Message From: - Fri Dec 07 14:52:01 2001 X-Mozilla-Status: 0001 X-Mozilla-Status2: Message-ID: [EMAIL PROTECTED] Date: Fri, 07 Dec 2001 14:51:56 +0100 From: Johan Holst Nielsen [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Organization: 1WAY2PRINT A/S User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1 X-Accept-Language: en-us MIME-Version: 1.0 To: Peter Lalka [EMAIL PROTECTED] Subject: Re: [PHP] Re: Image problem References: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Peter Lalka wrote: Thanks, in phpinfo list really isn't support for GIF:( How can I manipulate jpeg images? Which functions are for this img. format? P. The same, only one difference. You have to open a file with CreateImageFromJPEG etc. and ImageJPEG instead of etc. GIF Regards, Johan
RE: [PHP] Re: Image problem
PHP needs to be compiled with libjpeg and libpng in addition to the GD library to use those formats respectively. The PHP manual section covering image functions (including those for manipulating JPEGs and PNGs) is at http://www.php.net/manual/en/ref.image.php -Andy -Original Message- From: Peter Lalka [mailto:[EMAIL PROTECTED]] Sent: Friday, December 07, 2001 5:50 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Image problem Thanks, in phpinfo list really isn't support for GIF:( How can I manipulate jpeg images? Which functions are for this img. format? P. |+- || Johan [EMAIL PROTECTED] | || Odoslané kým: | || php-general-return-77040-lalkap=emo.seas.sk@lis| || ts.php.net | || | || | || 07.12.2001 14:30 | || | |+- - --| | | | Komu: [EMAIL PROTECTED] | | Kópia: | | Predmet:[PHP] Re: Image problem | - --| I've instaled and cofigured php4 on WinNT with Apache Web server. I can't use any fuction of Image manipulation, 'cause I get this error message: ImageGif: No GIF support in this PHP build In phpinfo() is listed that: gd lib. enabled, zlib lib. enabled. What do I still miss there? In the newest version of GD library (think it since about 1.3 or something) does support GIF, because GIF is a commerial image format. Use PNG or JPEG instead. That much better, or find a version with GIF support. You can see what Image formats you GD can use by make a file with follow content: ?php phpinfo(); ? :o) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]