Re: [PHP] image inventoryer
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey kbai...@howlermonkey.net wrote: html head titleImage inventory of this directory/title style TYPE=text/css body { margin-left: 10; margin-right: 10%; } body {background-attachment:fixed;} A:link, A:visited, A:active { text-decoration:none; } A:hover { text-decoration:underline; } .justify{text-align:justify;} .center{text-align:center;} /style /head body bgcolor=#A0A0A0 TEXT=BLACK LINKS=BLUE CENTERThis page inventories the contents of this directory and lists all image files in order- as the computer determines such matters. Here is the full inventory. hr align=center P ?php foreach (glob(*.*) as $filename) { echo 'img src='.$filename.''.br\n$filename\nP\n; } ? /body/html This works nicely. copied code from online manual, chainsaw editing to fit, superglue in the spare parts needed and it lists them all and composes proper img links to display on the inventory page. NOW I have the tool i needed; can someone else put this to good work? Well, congrats on a first somewhat useful program. All I have to say now is: you have a long way to go. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
Thank you! Not QUITE the first; I have used snippets and small routines for a while; however I did not know how to do this in php. Turns out there are at least 2 methods: glob, and an iteration of the directory with readdir() to build up an array, then one by one print the elements in the array. In python this is not hard. Iteration in python is somewhat different- not to mention getting used to do blocks. Being so used to snake charming, learning a new way means getting used to different procedures. On 4/8/2012 2:18 AM, tamouse mailing lists wrote: On Sat, Apr 7, 2012 at 10:35 PM, Kirk Baileykbai...@howlermonkey.net wrote: html head titleImage inventory of this directory/title style TYPE=text/css body { margin-left: 10; margin-right: 10%; } body {background-attachment:fixed;} A:link, A:visited, A:active { text-decoration:none; } A:hover { text-decoration:underline; } .justify{text-align:justify;} .center{text-align:center;} /style /head body bgcolor=#A0A0A0 TEXT=BLACK LINKS=BLUE CENTERThis page inventories the contents of this directory and lists all image files in order- as the computer determines such matters. Here is the full inventory. hr align=center P ?php foreach (glob(*.*) as $filename) { echo 'img src='.$filename.''.br\n$filename\nP\n; } ? /body/html This works nicely. copied code from online manual, chainsaw editing to fit, superglue in the spare parts needed and it lists them all and composes proper img links to display on the inventory page. NOW I have the tool i needed; can someone else put this to good work? Well, congrats on a first somewhat useful program. All I have to say now is: you have a long way to go. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
Kirk: Okay, you took the first step. Now please review this: ?php foreach (glob(images/*.jpg) as $filename) { echo(img src=\$filename\br$filename brbr); } ? Note: 1. This example does not put in all the embedded formatting shown in your example. What you did was simply bad form -- you should learn css as well. Also, you don't need to place the code within a bunch of html -- it will work as-is. 2. I always want my students to place images in an image directory -- the above conforms to that. 3. The example also shows how to separate the jpg's from other files in the directory. So, where do you want to go now? Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
Kirk Bailey kbai...@howlermonkey.net wrote in message news:4f7e5d2f.3050...@howlermonkey.net... jim, I am a novice at this language as I said. Then you are taking on too big of a task. When I decided to pick up some web programming skills I bought a $50 book/manual on learning PHP and another on MySQL. I read them - cover to cover. Then I made up simple tasks to develop in order to LEARN how it's actually done. Sounds like you not only want someone to program it for you, but probably help you implement it too. Sure - I or someone with time on their hands - could reply back with a couple hundred lines of code and give you your answer. Then what would you have gained? Hey - I gave you the outline of how this goal of yours could be accomplished. No need for your own pseudo-code at this point. Take mine and go do some research! Have fun! Then come back for clarification on what you're doing wrong once you have some actual code written. And were people this nice to you when YOU asked beginner questions? When I asked beginner questions, it was AFTER I had written something and ran into a roadblock. NOT before I had set pen to paper. You're asking how to get to California without having consulted a map yet. This site will be there for you when you have a problem - don't worry. Me included, not that my input is that worthy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Fri, Apr 6, 2012 at 8:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote: Kirk Bailey kbai...@howlermonkey.net wrote in message news:4f7e5d2f.3050...@howlermonkey.net... jim, I am a novice at this language as I said. Then you are taking on too big of a task. When I decided to pick up some web programming skills I bought a $50 book/manual on learning PHP and another on MySQL. I read them - cover to cover. Then I made up simple tasks to develop in order to LEARN how it's actually done. Sounds like you not only want someone to program it for you, but probably help you implement it too. Sure - I or someone with time on their hands - could reply back with a couple hundred lines of code and give you your answer. Then what would you have gained? Hey - I gave you the outline of how this goal of yours could be accomplished. No need for your own pseudo-code at this point. Take mine and go do some research! Have fun! Then come back for clarification on what you're doing wrong once you have some actual code written. And were people this nice to you when YOU asked beginner questions? When I asked beginner questions, it was AFTER I had written something and ran into a roadblock. NOT before I had set pen to paper. You're asking how to get to California without having consulted a map yet. This site will be there for you when you have a problem - don't worry. Me included, not that my input is that worthy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I googled php show images in folder and lo and behold the first was was a script almost exactly what you are wanting to do
Re: [PHP] image inventoryer
David OBrien dgobr...@gmail.com wrote in message news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com... I googled php show images in folder and lo and behold the first was was a script almost exactly what you are wanting to do Damn - now the OP missed a golden opportunity to do some research! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Apr 6, 2012 9:51 AM, Jim Giner jim.gi...@albanyhandball.com wrote: David OBrien dgobr...@gmail.com wrote in message news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com... I googled php show images in folder and lo and behold the first was was a script almost exactly what you are wanting to do Damn - now the OP missed a golden opportunity to do some research! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It's been my experience if they haven't even used google to see what premade scripts are available to do something similar then the research ain't gonna happen. They'd just post on ee or another forum where they could get the answer easier
Re: [PHP] image inventoryer
On Apr 5, 2012, at 10:26 PM, Kirk Bailey wrote: I need a page that will live in a directory and list all image files in there. That is, the page has img src=./foo.typeP tags emitted in it's structure, one per file in the directory with a saught file type- .png, .gif, .jpg, you get the idea. this should use relative addressing so once the tool is built I can use it in other directories as is. Now ai am still a novice at p[hp, how can I do this ? -- end Very Truly yours, - Kirk Bailey, Kirk: That will be a good exercise for you. If you want help, then show us something where you did something other than ask for the code. For example, show us *your* code (or attempt) to list all the files in a directory. That's pretty simple. After you do that, then we can move on to the next step. Please realize we are not here to write code for you but rather to help you with *your* code. Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 10:04 PM, Kirk Bailey kbai...@howlermonkey.net wrote: jim, I am a novice at this language as I said. And were people this nice to you when YOU asked beginner questions? When I ask beginner questions, I spend time doing my homework first. This list is not a class to teach you to write PHP. The people here are not going to hold your hand and feed you spoonfuls of PHP knowledge. Read first. Ask smart questions. There are BOATLOADS of tutorials on PHP on the net, just a google away. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
tamouse mailing lists tamouse.li...@gmail.com wrote in message news:CAHUC_t-M_dg_D+if01BQm=RPd=GgL7d=naxfadxwybse-nn...@mail.gmail.com... knowledge. Read first. Ask smart questions. There are BOATLOADS of tutorials on PHP on the net, just a google away. I like that! just a google away. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 7:26 PM, Kirk Bailey kbai...@howlermonkey.net wrote: Now ai am still a novice at p[hp, how can I do this ? Have you read any book on PHP? even the official from PHP.net? Learn the tool so you know how to use it, efficiently. Otherwise how do you know if the tool can do what you want... What you're asking for ATM is someone to write the code for you which is not how it works. You need to provide some code, or even pseudo code at least... HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
As Tommy says - you sound like a total new user who doesn't know how to do it and furthermore doesn't know how many things you are going to have to pick up just to accomplish this task. You have to: determine the folder your script is running from collect an array of image file names from that directory determine the size of each of these images so that you are not building some html that will try to display an unmanageable amount of data all at once. You may then have to learn how to create smaller images for your img tags, which is another learning process in itself determine how many images you will display and decide again if you really can allow the user to make this kind of request. This could also create another step in the process to keep track of what images have already been displayed so that when the screen comes back to your script you can pick up where you left off and display a second page. THEN you can generate the html to produce a useful page of images. At least that's how I would approach it. And I'm not an expert but simply a guy who has put in about a year's worth of effort into learning enough php to actually do something like this already, among other things. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
ok. ?php filelist=inventory all files in directory ./ for file in filelist: // walk a listing of many items IF filetype in gif, jpg, png { echo 'img src=./'.file.'P' // notice that is a 'singlequote' immedately followed by a doublequote. ? Something like this. In python I would write something like: #!/usr/bin/python import string, glob files=glob.glob(./*.*) # files is a list variable (a 1 dimensional addressable array) for file in files: # for each cell in files do this doblock: if str.split(file,'.')[1] in gif,jpg,png): #if the file type is in a list of acceptable types, print 'img src=./'+file+'P'# print out the material to return surrounding # the file name On 4/5/2012 10:34 PM, Tommy Pham wrote: On Thu, Apr 5, 2012 at 7:26 PM, Kirk Baileykbai...@howlermonkey.net wrote: Now ai am still a novice at p[hp, how can I do this ? Have you read any book on PHP? even the official from PHP.net? Learn the tool so you know how to use it, efficiently. Otherwise how do you know if the tool can do what you want... What you're asking for ATM is someone to write the code for you which is not how it works. You need to provide some code, or even pseudo code at least... HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
jim, I am a novice at this language as I said. On 4/5/2012 10:44 PM, Jim Giner wrote: As Tommy says - you sound like a total new user who doesn't know how to do it and furthermore doesn't know how many things you are going to have to pick up just to accomplish this task. You have to: determine the folder your script is running from collect an array of image file names from that directory determine the size of each of these images so that you are not building some html that will try to display an unmanageable amount of data all at once. You may then have to learn how to create smaller images for your img tags, which is another learning process in itself determine how many images you will display and decide again if you really can allow the user to make this kind of request. This could also create another step in the process to keep track of what images have already been displayed so that when the screen comes back to your script you can pick up where you left off and display a second page. THEN you can generate the html to produce a useful page of images. At least that's how I would approach it. And I'm not an expert but simply a guy who has put in about a year's worth of effort into learning enough php to actually do something like this already, among other things. And were people this nice to you when YOU asked beginner questions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 8:02 PM, Kirk Bailey kbai...@howlermonkey.net wrote: If you don't want to read the manual or a book, you could quickly do some Google'ing as below: ok. ?php filelist=inventory all files in directory ./ filesystem site:php.net for file in filelist: // walk a listing of many items loop site:php.net IF filetype in gif, jpg, png { condition site:php.net echo 'img src=./'.file.'P' // notice that is a 'singlequote' immedately followed by a doublequote. ? Or just look at the table of contents in the official manual to see what PHP has to offer and see what you can do since you already have some programming experience. Something like this. In python I would write something like: #!/usr/bin/python import string, glob files=glob.glob(./*.*) # files is a list variable (a 1 dimensional addressable array) for file in files: # for each cell in files do this doblock: if str.split(file,'.')[1] in gif,jpg,png): #if the file type is in a list of acceptable types, print 'img src=./'+file+'P' # print out the material to return surrounding # the file name On 4/5/2012 10:34 PM, Tommy Pham wrote: On Thu, Apr 5, 2012 at 7:26 PM, Kirk Baileykbai...@howlermonkey.net wrote: Now ai am still a novice at p[hp, how can I do this ? Have you read any book on PHP? even the official from PHP.net? Learn the tool so you know how to use it, efficiently. Otherwise how do you know if the tool can do what you want... What you're asking for ATM is someone to write the code for you which is not how it works. You need to provide some code, or even pseudo code at least... HTH, Tommy PS: don't top post since it's preferred on this list. You can search the archive for the discussion about it. HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Rotation Script
There are tons of (free) jquery gadgets that do image rotation. All you'd need to do is push the list out to the jquery script. Cheers, Curtis On 10/15/2011 10:50 AM, d...@nkmo.com wrote: We have a simple script which rotates and image to a random value, saves it to a cache directory and displays it. For some reason when I move the script from a Debian box over to the production CentOS machine, it no longer caches any of the images. the rest works, but not the cache. If you could look at it and see if anything jumps out at you, please let me know. install the code below to the directory /angles .htaccess: RewriteEngine on RewriteRule ^rotate_(\d+)(?:_(?:\d+))?.png$ rotate.php?im=$1 rotate.php: ?php // Setup if(isset($_GET['im']) file_exists($_GET['im'].'.png')) { header('Content-type: image/png'); $im = $_GET['im'].'.png'; $degrees = rand(0, 360); $save = 'cache/'.$_GET['im'].'_'.$degrees.'.png'; if(!file_exists($save)) { // Rotate via command line and cache it exec('convert '.$im.' -filter \'Lanczos\' -resize \'150x150\' -rotate '.$degrees.' -black-threshold 40% '.$save, $out); } // Output out (newly?) cached file echo file_get_contents($save); } else { die(Image not found); } ? Use it by url: http://www.servername.com/angles/rotate_019.png Each time you reload page the angle should rotate to a new position.
Re: [PHP] Image Rotation Script
On 15 Oct 2011, at 15:50, d...@nkmo.com wrote: We have a simple script which rotates and image to a random value, saves it to a cache directory and displays it. For some reason when I move the script from a Debian box over to the production CentOS machine, it no longer caches any of the images. the rest works, but not the cache. If you could look at it and see if anything jumps out at you, please let me know. install the code below to the directory /angles .htaccess: RewriteEngine on RewriteRule ^rotate_(\d+)(?:_(?:\d+))?.png$ rotate.php?im=$1 rotate.php: ?php // Setup if(isset($_GET['im']) file_exists($_GET['im'].'.png')) { header('Content-type: image/png'); $im = $_GET['im'].'.png'; $degrees = rand(0, 360); $save = 'cache/'.$_GET['im'].'_'.$degrees.'.png'; if(!file_exists($save)) { // Rotate via command line and cache it exec('convert '.$im.' -filter \'Lanczos\' -resize \'150x150\' -rotate '.$degrees.' -black-threshold 40% '.$save, $out); } // Output out (newly?) cached file echo file_get_contents($save); } else { die(Image not found); } ? Use it by url: http://www.servername.com/angles/rotate_019.png Each time you reload page the angle should rotate to a new position. My first thought was that the current working directory is probably set differently. However, you say that the script works and presents the rotated images, it's just the cache that isn't right. I still think I'm probably correct, so try these changes... $im = dirname(__FILE__).'/'.$_GET['im'].'.png'; and... $save = dirname(__FILE__).'/cache/'.$_GET['im'].'_'.$degrees.'.png'; You also have a pretty major hole here because you're taking a querystring parameter and putting it straight into a command line. What happens if I pass the value of $_GET['im'] as ../../../../../../../../../../../etc/passwd ? Use escapeshellarg when putting variables into command lines to protect against this type of hack. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
Dan Joseph wrote: Hi, I'm wondering how you all are doing image replication between servers. I've got some things in mind, but I'd like to see how others have done it. We have a PHP application that accepts an image upload, then we want it to show up on the other 2 web servers. We have 3 in a load balanced cluster. Linux servers. How did you go about it? rsync triggered by inotify. -- Per Jessen, Zürich (27.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
We are doing it with nfs mount which is mounted on all servers -- Shafiq http://shafiq.pk *** This Message Has Been Sent Using BlackBerry Internet Service from Mobilink *** -Original Message- From: Dan Joseph dmjos...@gmail.com Date: Tue, 20 Jul 2010 10:21:55 To: PHP eMail Listphp-general@lists.php.net Subject: [PHP] Image Replication Hi, I'm wondering how you all are doing image replication between servers. I've got some things in mind, but I'd like to see how others have done it. We have a PHP application that accepts an image upload, then we want it to show up on the other 2 web servers. We have 3 in a load balanced cluster. Linux servers. How did you go about it? -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
On Tue, Jul 20, 2010 at 10:35 AM, rehma...@gmail.com wrote: We are doing it with nfs mount which is mounted on all servers -- Shafiq http://shafiq.pk *** This Message Has Been Sent Using BlackBerry Internet Service from Mobilink *** -Original Message- From: Dan Joseph dmjos...@gmail.com Date: Tue, 20 Jul 2010 10:21:55 To: PHP eMail Listphp-general@lists.php.net Subject: [PHP] Image Replication Hi, I'm wondering how you all are doing image replication between servers. I've got some things in mind, but I'd like to see how others have done it. We have a PHP application that accepts an image upload, then we want it to show up on the other 2 web servers. We have 3 in a load balanced cluster. Linux servers. How did you go about it? -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Our app runs using a piece of SAN / NAS storage common to all servers -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image question again
On Tue, 2010-04-06 at 21:44 -0500, Karl DeSaulniers wrote: When I have an imagecreatetruecolor and I create another one and use imagecopymerge, how do I keep the backgrounds transparent even if say the width of the top image is smaller than the back image? I keep getting a black background where the top image does not cover the back. It sets the transparency to the rest of the top image as long as it is covering the bottom one. I think it has to do with the imagealphablending. Any ideas? TIA Karl DeSaulniers Design Drumm http://designdrumm.com If it's just that the images are different sizes, then imagecopyresample might be the better option. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] image upload keeps file name ?
On Thu, 2010-04-01 at 10:51 +0100, Matthew Croud wrote: Hi Guys, Can someone confirm for me that the code below will move an uploaded file and give it the same name as the original image file name ? $file_dir = /home/uploads; foreach($_FILES as $file_name = $file_array) { echo path: .$file_array[tmp_name].br/\n; echo name: .$file_array[name].br/\n; echo type: .$file_array[type].br/\n; echo size: .$file_array[size].br/\n; $UploadName[$num] = $file_array[name]; $num++; if (is_uploaded_file($file_array[tmp_name])) { move_uploaded_file($file_array[tmp_name], $file_dir/. $file_array[name]) or die (Couldn't copy); echo file was moved!br/; } } Many thanks, Yes, the original filename comes from the [name] array element. However, if someone is uploading a filename with the same name as one that already exists, you will be overwriting it. For peace of mind, I've always found it best to save the file using the tmp_name given to it by PHP, and store this against the original filename in a database. You can then use PHP to deliver the file back to the user when it's needed as either a download or something displayed in the browser. This works nicely with storing files outside of the web root, which will prevent people from maliciously uploading files to attempt to break your server and/or app. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] image upload keeps file name ?
I use the follwing function for moving files: public function moveFile($file,$targetdir=../uploads/images/) { $fileName = $file['name']; $ext = substr($fileName, strrpos($fileName, '.') + 1); do { $targetfilename=md5(date(m.d.y.h.i.s).basename($fileName)).'.'.$ext; $fullname=$targetdir.$targetfilename; }while(file_exists($fullname)); move_uploaded_file($file[tmp_name],$fullname); return $fullname; } Call the fn as : foreach($_FILES as $file_name = $filearray) { if( $filearray['error']=='') { $filenametobestored=moveFile($filearray); /*Enter name into db here*/ } } this will make sure you never over write anyfiles.. Midhun Girish On Thu, Apr 1, 2010 at 3:25 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: of the web root, which will prevent people from maliciously uploadi
Re: [PHP] Image Headers break when image is out of bounds
On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote: I've got a bit of a weird one here. I'm using PHP to output an image. This works fine when I output as a file, but when I try to feed it directly to the browser it fills the screen with random characters. I know I've got the headers right, as it works some of the time. The only thing I can spot when it does fail is that some of the image drawing commands are essentially drawing off the edge of the image area. I've checked the error logs, and the only errors/notices I can find today are a bug in phpMyAdmin and a missing favicon file, nothing to do with this script. Has anybody ever noticed a similar problem? Thanks, Ash http://www.ashleysheridan.co.uk Oh. I should note that there has been no headers sent already, as I put the image output part inside of a if(!headers_sent()) block. The headers I'm using for the PNG image are: header(Content-Type: image/png); header(Pragma: no-cache); header(Expires: 0); Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Headers break when image is out of bounds
On Tue, Aug 11, 2009 at 1:08 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote: I've got a bit of a weird one here. I'm using PHP to output an image. This works fine when I output as a file, but when I try to feed it directly to the browser it fills the screen with random characters. I know I've got the headers right, as it works some of the time. The only thing I can spot when it does fail is that some of the image drawing commands are essentially drawing off the edge of the image area. I've checked the error logs, and the only errors/notices I can find today are a bug in phpMyAdmin and a missing favicon file, nothing to do with this script. Has anybody ever noticed a similar problem? Thanks, Ash http://www.ashleysheridan.co.uk Oh. I should note that there has been no headers sent already, as I put the image output part inside of a if(!headers_sent()) block. The headers I'm using for the PNG image are: header(Content-Type: image/png); header(Pragma: no-cache); header(Expires: 0); Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Take the if (!headers_sent()) out and always send the headers. -- - Adam Shannon ( http://ashannon.us )
Re: [PHP] Image Headers break when image is out of bounds
On Tue, 2009-08-11 at 13:29 -0500, Adam Shannon wrote: On Tue, Aug 11, 2009 at 1:08 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote: I've got a bit of a weird one here. I'm using PHP to output an image. This works fine when I output as a file, but when I try to feed it directly to the browser it fills the screen with random characters. I know I've got the headers right, as it works some of the time. The only thing I can spot when it does fail is that some of the image drawing commands are essentially drawing off the edge of the image area. I've checked the error logs, and the only errors/notices I can find today are a bug in phpMyAdmin and a missing favicon file, nothing to do with this script. Has anybody ever noticed a similar problem? Thanks, Ash http://www.ashleysheridan.co.uk Oh. I should note that there has been no headers sent already, as I put the image output part inside of a if(!headers_sent()) block. The headers I'm using for the PNG image are: header(Content-Type: image/png); header(Pragma: no-cache); header(Expires: 0); Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Take the if (!headers_sent()) out and always send the headers. @Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been sent, send the correct ones for the image. @Martin The image is being produced by PHP. The command I'm using to output the image is image_png(), and my OS is correctly reporting a PNG image (Linux will use the extension as a hint, but gets the filetype from the contents). Also, for further clarification, the junk output I'm getting has the letters PNG in the first few characters, so I'm pretty sure this is a PNG image yes! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Headers break when image is out of bounds
@Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been sent, send the correct ones for the image. But if there are headers that have been sent, it sounds like they would not have been the correct ones. Which I think would cause exactly the problem you're describing. Ben
Re: [PHP] Image Headers break when image is out of bounds
On Tue, Aug 11, 2009 at 11:52 AM, Ben Dunlap bdun...@agentintellect.comwrote: @Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been sent, send the correct ones for the image. But if there are headers that have been sent, it sounds like they would not have been the correct ones. Which I think would cause exactly the problem you're describing. Ben Oops, looked back at your earlier post and it sounds like you only send the image inside the if(!headers_sent()) block. Never mind, pls disregard my earlier noise. Ben
Re: [PHP] Image Headers break when image is out of bounds
On Tue, 2009-08-11 at 11:54 -0700, Ben Dunlap wrote: On Tue, Aug 11, 2009 at 11:52 AM, Ben Dunlap bdun...@agentintellect.com wrote: @Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been sent, send the correct ones for the image. But if there are headers that have been sent, it sounds like they would not have been the correct ones. Which I think would cause exactly the problem you're describing. Ben Oops, looked back at your earlier post and it sounds like you only send the image inside the if(!headers_sent()) block. Never mind, pls disregard my earlier noise. Ben Well, this will teach me to pay more attention. Turns out, I was attempting to output the image before the headers! It was a red herring that the image was displaying correctly when the drawing commands were all inside of the image area. It's probably more of a feature of Fx to try and recognise the content it's been sent if it can? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resizing
This one time, at band camp, Stephen Alistoun stephenalist...@gmail.com wrote: I want all the images to resize to 100px width but the height adjusts automatically. Two ways, GD or Imagick http://www.phpro.org/examples/GD-Thumbnail-Based-On-Image-Type.html http://www.phpro.org/tutorials/Imagick.html#4 Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resizing
i use imageMagick: ?php $image_path = ../images/myimage.jpg; //path to the image from my script $thumb_path = ../thumbnails/mymage.jpg;//path to where i want the thumbnail to be created $width = 100; //greatest allowed width for my thumbnails $height = 100; //greatest allowed height for my thumbnails //make the thumbnail //imageMagick will automatically adjust for aspect ratio with this command line //however, if you want to force a thumbnail to the preset dimensions, //put an exclamation point after $height //http://www.imagemagick.org/Magick++/Geometry.html $command_line = convert -geometry $width . x . $height $image_path $thumb_path; system($command_line, $return_var); if ($return_var == 1) { echo Thumbnail creation failed! :(; } else { echo Thumbnail created. :) a href='$thumb_path' target='_blank'View Thumbnail FFS/a; } ? if you run into problems, and assuming imageMagick was successfully installed: - make sure you have write permission for where you want the thumbnail to be created - try replacing convert with the full path to the convert app. e.g. $command_line = /usr/bin/convert -geometry etc; - run the script from the command line. ssh in to your script's directory and try typing this: php thumbscript.php you'll see verbose messages to help you pinpoint the problem. depending on your setup, you might have to put in the full path to php - if you're still stuck, try putting in this line: ?php ini_set(display_errors,1); information like this would have saved me hours of my life On Sun, Dec 21, 2008 at 3:54 AM, Kevin Waterson ke...@phpro.org wrote: This one time, at band camp, Stephen Alistoun stephenalist...@gmail.com wrote: I want all the images to resize to 100px width but the height adjusts automatically. Two ways, GD or Imagick http://www.phpro.org/examples/GD-Thumbnail-Based-On-Image-Type.html http://www.phpro.org/tutorials/Imagick.html#4 Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Crunchmutt Studios Latest News Headlines: http://www.rssvideonews.com http://www.imagepoop.com http://www.crunchmutt.com http://www.deadjoe.com http://www.dailymedication.com http://www.extremesportclips.com http://www.coolanimalclips.com http://www.robotclips.com http://www.newsfinger.com http://www.postyourimage.com http://www.nakedalarmclock.com
Re: [PHP] Image Resizing
At 12:38 PM -0800 12/20/08, Stephen Alistoun wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes: (1) 200px width and 350px height (2) 125px width and 220px height (3) 166px width and 455px height I want all the images to resize to 100px width but the height adjusts automatically. Regards, Stephen Stephen: Here's the code. http://webbytedd.com/b/thumb/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resizing
nice post Tedd and useful web site :) -Gary tedd tedd.sperl...@gmail.com wrote in message news:p06240802c573f5a71...@[192.168.1.101]... At 12:38 PM -0800 12/20/08, Stephen Alistoun wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes: (1) 200px width and 350px height (2) 125px width and 220px height (3) 166px width and 455px height I want all the images to resize to 100px width but the height adjusts automatically. Regards, Stephen Stephen: Here's the code. http://webbytedd.com/b/thumb/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resizing
With the built in functions (GD), you can read up on this function: http://is.php.net/manual/en/function.imagecopyresized.php If you have Imagick installed, you can read up on this: http://is.php.net/manual/en/function.imagick-thumbnailimage.php On Sat, Dec 20, 2008 at 8:38 PM, Stephen Alistoun stephenalist...@gmail.com wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes: (1) 200px width and 350px height (2) 125px width and 220px height (3) 166px width and 455px height I want all the images to resize to 100px width but the height adjusts automatically. Regards, Stephen -- View this message in context: http://www.nabble.com/Image-Resizing-tp21108753p21108753.html Sent from the PHP - General mailing list archive at Nabble.com. -- 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] Image Resizing
On Sat, 2008-12-20 at 20:59 +, Ólafur Waage wrote: With the built in functions (GD), you can read up on this function: http://is.php.net/manual/en/function.imagecopyresized.php If you have Imagick installed, you can read up on this: http://is.php.net/manual/en/function.imagick-thumbnailimage.php On Sat, Dec 20, 2008 at 8:38 PM, Stephen Alistoun stephenalist...@gmail.com wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes: (1) 200px width and 350px height (2) 125px width and 220px height (3) 166px width and 455px height I want all the images to resize to 100px width but the height adjusts automatically. Regards, Stephen -- View this message in context: http://www.nabble.com/Image-Resizing-tp21108753p21108753.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php RTFM http://uk.php.net/manual/en/function.imagecopyresampled.php Ash www.ashleysheridan.co.uk
Re: [PHP] Image Manipulation
At 7:16 PM -0500 11/9/08, Ron Piggott wrote: Is there a way to find out the number of pixels wide and high an image is in PHP? Is there a way to resize an image using PHP? Ron Yes tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Manipulation
Ron Piggott schreef: Is there a way to find out the number of pixels wide and high an image is in PHP? Is there a way to resize an image using PHP? heh Ron, you've been around this list long enough to know that you should STFW and RTFM before posting questions. http://www.google.com/search?q=php+image+size lo and behold the first result item. the way it goes is like this, every time you think 'hey can I do that' there is a very big chance some 12yo has already done it, blogged about it, posted code on phpclasses.org (or some such place) and printed a T-Shirt to celebrate the fact ... I know this from experience (not because I'm the 12yo .. although some might say so) Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Manipulation
On Sun, 2008-11-09 at 19:16 -0500, Ron Piggott wrote: Is there a way to find out the number of pixels wide and high an image is in PHP? Is there a way to resize an image using PHP? Ron Yes. Look at the PHP GD manual. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Generation
I don't think GD has a built-in function to scale an image the way you are asking, and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk ---BeginMessage--- Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 19/08/2008 18:53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Generation
Alex Chamberlain schreef: Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? GD can do all this, although I hear said that ImageMagick does more and has somewhat better output. you'll only be able to offer fonts that you have installed on the server, also image generation works in pixels so you'll have to come up with a way to 'convert' millimeters to a pixel value for display purposes. I offer you a class that you might be able to use, at least for inspiration ... the pertinent functions used are ImageColorAllocate(), ImageTTFBBox() and ImageTTFText() ? /* * Example: $renderer = new RenderTTFText( 81, 756 ); $renderer-setOffset( 28, 40 ); $renderer-setBgImage( '/images/headerbase-lightblue.jpg' ); // $renderer-setBgColor( ??? ); $renderer-setLifetime( 1000 ); // $renderer-setMaxLines( 1 ) $renderer-render( array( 'THESE', 'ARE', 'strings' ), array( 10, 14, 18 ), array( '/fonts/arial.ttf', '/fonts/verdana.ttf', '/fonts/symbol.ttf' ), ); * */ class RenderTTFText { var $xsize, $ysize; var $xoffset, $yoffset, $margin; var $bgimage, $bgimagetype; var $bgcolor, $fgcolor; var $lifetime; var $maxLines; var $transparent; // nasty little hack :-) var $stringSpacingOffsetTweak; var $im; // reference to the image resource. function RenderTTFText($xsize = null, $ysize = null) { $this-xsize= (is_integer($xsize) $xsize) ? 100: $xsize; $this-ysize= (is_integer($ysize) $ysize) ? 100: $ysize; $this-xoffset = 0; $this-yoffset = 0; $this-margin = 0; $this-bgcolor = array(0,0,0); $this-fgcolor = array(255,255,255); $this-lifetime = 0; $this-maxLines = 1; $this-transparent = false; $this-stringSpacingOffsetTweak = 0; } function setOffset($x,$y,$m = 0) { $this-xoffset = intval($x); $this-yoffset = intval($y); $this-margin = intval($y); } function setBgImage($img_file) { $this-bgimage = $img_file; list($this-xsize, $this-ysize, $this-bgimagetype) = GetImageSize($this-bgimage); } function setBgColor($color) { $this-bgcolor = $this-convColor($color); } function setLifetime($t) { $this-lifetime = intval($t); } function setMaxLines($l) { if (($l = intval($l)) 0) { $this-maxLines = $l; } } function setTransparent($b = true) { $this-transparent = (boolean)$b; } function setStringSpacingOffsetTweak($v) { if (is_numeric($v)) { $this-stringSpacingOffsetTweak = $v; } } /* * $text, a string or array of strings. - strings to display in order. * $size, a float or an array of floats - which size to display the related text at. * $font, a fontfilename or an array of fontfilenames - which font to use for the related text string * $br, a boolean, or an array of bools - whether to follow the related $text string with a line break */ function render($text, $size, $font, $color, $br = false) { /* our text items to render (each item can have a seperate size, font and linebreak(true/false) */ foreach (array('text','size','font','color','br') as $arg) { if (!is_array(${$arg})) $$arg = array(${$arg}); if ($arg == 'text') { $tcount = count($text); $text = array_map('trim', $text); } else { while (($c = count(${$arg})) $tcount) { if (!isset(${$arg}[$c - 1])) { return false; } ${$arg}[$c] = ($arg == 'br') ? false : ${$arg}[$c - 1]; } } ${$arg} = array_values(${$arg}); } /* create the background/base image */ if (! empty($this-bgimage)) { switch ($this-bgimagetype) { case 3:
Re: [PHP] Image Generation
Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed, 20 Aug 2008 08:30:51 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:26502] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/47-51571-A28CBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 03:30:50 -0400 Received: (qmail 5047 invoked by uid 1010); 20 Aug 2008 07:30:37 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 5040 invoked from network); 20 Aug 2008 07:30:37 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Received-SPF: error (pb1.pair.com: domain alexchamberlain.co.uk from 79.170.40.18 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 79.170.40.18 mail18.extendcp.co.uk Linux 2.5 (sometimes 2.4) (4) Bericht-ID: [EMAIL PROTECTED] MIME-versie: 1.0 Content-Type: text/plain; charset=windows-1250 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AckCloefPR8PGF4zQNGV6eViXsKrxQ== Content-Language: en-gb Content-Transfer-Encoding: base64 Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 19/08/2008 18:53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Generation
Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. Ash www.ashleysheridan.co.uk ---BeginMessage--- Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed, 20 Aug 2008 08:30:51 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:26502] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/47-51571-A28CBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 03:30:50 -0400 Received: (qmail 5047 invoked by uid 1010); 20 Aug 2008 07:30:37 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 5040 invoked from network); 20 Aug 2008 07:30:37 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Received-SPF: error (pb1.pair.com: domain alexchamberlain.co.uk from 79.170.40.18 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 79.170.40.18 mail18.extendcp.co.uk Linux 2.5 (sometimes 2.4) (4) Bericht-ID: [EMAIL PROTECTED] MIME-versie: 1.0 Content-Type: text/plain; charset=windows-1250 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AckCloefPR8PGF4zQNGV6eViXsKrxQ== Content-Language: en-gb Content-Transfer-Encoding: base64 Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date:
Re: [PHP] Image Generation
Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] Aan: [EMAIL PROTECTED] CC: Alex Chamberlain [EMAIL PROTECTED], PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: [EMAIL PROTECTED] User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: [EMAIL PROTECTED] [EMAIL PROTECTED] In-Reply-To: [EMAIL PROTECTED] X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed
Re: Re: [PHP] Image Generation
BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so
Re: Re: [PHP] Image Generation
Yes, if you wish to stretch text in this way then you will have to create the image and stretch. You can create the image in memory and perform the stretching on it there if you are worried about writing too many temporary images to the server. Ash www.ashleysheridan.co.uk ---BeginMessage--- BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel
Re: Re: [PHP] Image Generation
Hi Alex, I did reply to this, but it apparently didn't get to you. You will need to create a separate image with the text in, as GD offers no function to create text already stretched (actually, it's text offerings are sparse to say the least). You can create this image in memory if you are worrying about creating a lot of files on your server though, and then perform resizing operations on the image in memory. Ash www.ashleysheridan.co.uk ---BeginMessage--- BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM
Re: [PHP] Image modifications
Ronald Wiplinger wrote: I would like to find some samples to start with. We want to upload a picture and the user may apply some filters or instructions to create a new picture, based on the uploaded picture and the available filters and instructions. The idea of it is not really mature, since we have no idea where to start and what is possible to do. Depends. What do you want to do (what is a filter, what are instructions)? imagemagick and to a (much?) lesser extent, gd - let you do image manipulations but it depends what you need to be able to do. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image* Functions' Memory Usage
On Jan 4, 2008, at 9:54 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 4, 2008 12:46 PM, Casey [EMAIL PROTECTED] wrote: Greetings, list. I have a web application that generates PNG images that are thousands of pixels high by thousands of pixels wide (using imagepng, etc.). The problem is this takes way too much memory, and the rest of the site becomes too slow. I'm working on something to cache the images, but some suggestions in the meantime would be great. Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much. It depends on what you are trying to do with the images. Are you randomly-generating data to create patterns, or are you (*gasp*) converting small images into [very pixelized] larger ones? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. I'm laying many different other (smaller) images over each other at various positions. (I know HTML/CSS and SVG could do this with less trouble, but that would give away my secrets by just viewing the source.) -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image* Functions' Memory Usage
On Jan 4, 2008 12:46 PM, Casey [EMAIL PROTECTED] wrote: Greetings, list. I have a web application that generates PNG images that are thousands of pixels high by thousands of pixels wide (using imagepng, etc.). The problem is this takes way too much memory, and the rest of the site becomes too slow. I'm working on something to cache the images, but some suggestions in the meantime would be great. Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much. It depends on what you are trying to do with the images. Are you randomly-generating data to create patterns, or are you (*gasp*) converting small images into [very pixelized] larger ones? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image* Functions' Memory Usage
On Jan 4, 2008 12:59 PM, Casey [EMAIL PROTECTED] wrote: [snip] I'm laying many different other (smaller) images over each other at various positions. (I know HTML/CSS and SVG could do this with less trouble, but that would give away my secrets by just viewing the source.) Okay, so kind of like a mural, but for a different purpose. For size, Flash would be your best bet, because everything is converted to a Vector but getting PHP to output to that is beyond my scope of knowledge, to be honest. I would probably do things with GD or ImageMagick, as you've already hinted. NetPBM might even be a viable alternate route. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image* Functions' Memory Usage
Casey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jan 4, 2008, at 9:54 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 4, 2008 12:46 PM, Casey [EMAIL PROTECTED] wrote: Greetings, list. I have a web application that generates PNG images that are thousands of pixels high by thousands of pixels wide (using imagepng, etc.). The problem is this takes way too much memory, and the rest of the site becomes too slow. I'm working on something to cache the images, but some suggestions in the meantime would be great. Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much. It depends on what you are trying to do with the images. Are you randomly-generating data to create patterns, or are you (*gasp*) converting small images into [very pixelized] larger ones? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. I'm laying many different other (smaller) images over each other at various positions. (I know HTML/CSS and SVG could do this with less trouble, but that would give away my secrets by just viewing the source.) -Casey Have you considered obscuficated javascript? It's not very hard to have JS add a few images and rotate/move them where ever you want. Plus there's not too many people that could make much sense from clear plain JS anyway. Flash is also a good bet. - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image* Functions' Memory Usage
I recently made two commercial sites that used both GD and Imagick and i can share some wisdom i got from those projects. (both projects were card generators where users made their custom cards and but one had a fixed picture and users could add text and the other one allowed users to add their own picture with text) # Some functions of the GD library are VERY memory intensive. For example the image resizing. The resizing process is calling three functions to work and two of them are holding very large amounts of data within them. (the original image and the new image area you are going to put the resized image into, and then the 3rd functions resizes the image) # Basic GD library functions can be quite fast (and most if not all Imagick functions are fast if the image isn't too big) # Speed of both options are always affected by the size of the image being used. (Size in bytes, a 10x15 print quality card generated with a user selected image + text can take up to 30 seconds to generate) And yes thats an annoying generator to debug. # If you are going beyond simple things like adding text onto an image i recommend going with Imagick. # Imagick is a great system to use if you learn all the command lines and combinations, far superior to GD in many ways. # Complex Imagick functions (that works with all possible outcomes) can be VERY slow. # If you have the choice of running Imagick from the command line (installed onto the linux system) or running the Imagick PHPlib, go with the PHP library one (even though it looks like more overhead in code) since error reporting with the command line is close to none. # If you have the choice of the images being generated later (ie. by an admin of the system), go with that path always. (one of my systems does that and the other doesn't) and the problems with the end users on the image generating step are very hard to debug, since they usually describe the problems very badly. Hope this helps some. - Ólafur Waage [EMAIL PROTECTED] 2008/1/4, Casey [EMAIL PROTECTED]: Greetings, list. I have a web application that generates PNG images that are thousands of pixels high by thousands of pixels wide (using imagepng, etc.). The problem is this takes way too much memory, and the rest of the site becomes too slow. I'm working on something to cache the images, but some suggestions in the meantime would be great. Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much. - Casey -- 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] image galleries
Lisa A escribió: 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. gallery2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image manipulation on the fly
Hi Merlin, that is very fast for 1024 images, you will not get much more speed if you try doing anything smarter , though there are some image libraries that are faster than GD libs eg www.imagemagick.org On Nov 8, 2007, at 5:13 PM, Merlin wrote: 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. Does anybody know a high performing image funtion that would allow me to brighten up the picture on the fly, or any other effect similar to it? I am attaching the sepia function I am using. Thank you for any help or suggestion on how to solve that. Best regards, Merlin function image_effect_sepia($im){ $start_red = 2; //red scale at black $start_blue = 2.3; //blue scale at black $red_scale = ($start_red-1)/256;//red modifier as greyscale goes to white $blue_scale = ($start_blue - 1)/256;//ditto for blue //build a sepia lookup table $sepia = array(); for($x = 0;$x 256;$x++){ $red = intval($x * ($start_red - ($x * $red_scale))); if($red 255) $red = 255; $blue = intval($x / ($start_blue - ($x * $blue_scale))); $sepia[$x][0] = $red; $sepia[$x][1] = $blue; } # modify the image for($y = 0;$y imagesy($im);$y++){ for($x = 0;$x imagesx($im);$x++){ $pixel = imagecolorat($im, $x, $y); $red = ($pixel 0xFF) 16; $green = ($pixel 0x00FF00) 8; $blue = $pixel 0xFF; $alpha = $pixel 0x7F00; //get a greyscale value $gs = intval(($red * 0.3) + ($green * 0.59) + ($blue * 0.11)); $p = $alpha | $sepia[$gs][1] | ($gs 8) | ($sepia[$gs] [0] 16); imagesetpixel ($im, $x, $y, $p); } } # return the moddifyed image return $im; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Bojan Tesanovic http://www.classicio.com/
Re: [PHP] Image manipulation on the fly
Merlin wrote: 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. Yeah, you're doing CPU-intensive stuff in an interpreted language - it'll never be efficient unless you write it in C or similar. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion... OT!
On Saturday 08 September 2007 12:48, Tony Di Croce wrote: I need to convert (resize, and store as blob's in a mysql db) oh oh oh... NO we can slap the horse again ;D images my users can upload. I'm wondering what the best conversion tool is... I'm considering ImageMagick... Is this the best? consider using something you know for starters, then expand? as for the question itself, yes is it the best? anyone? Is their anything that is integrated with PHP itself? td -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion...
On 9/8/07, Tony Di Croce [EMAIL PROTECTED] wrote: I need to convert (resize, and store as blob's in a mysql db) images avoid that for no further problems. ImageMagick you can use this tool for your needs. -- Romanul s-a nascut poet. Trebuia sa se nasca neamt! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion... OT!
Børge Holen wrote: On Saturday 08 September 2007 12:48, Tony Di Croce wrote: I need to convert (resize, and store as blob's in a mysql db) oh oh oh... NO we can slap the horse again ;D images my users can upload. I'm wondering what the best conversion tool is... I'm considering ImageMagick... Is this the best? consider using something you know for starters, then expand? as for the question itself, yes is it the best? anyone? Best is subjective, does it work the best? IMO yes, it's the best tool, but keep in mind, this makes your script less portable, not all hosts will allow you to run the 'convert' binary, nor will all installations have it readily available (Windows doesn't come with ImageMagick by default). It works the best for the applications I've written so far, but the PHP gd functions are just as powerful and probably more portable.. so without knowing all your requirements, it's hard to give a definitive answer :). Is their anything that is integrated with PHP itself? td -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion... OT!
On Saturday 08 September 2007 13:59, Vidyut Luther wrote: Børge Holen wrote: On Saturday 08 September 2007 12:48, Tony Di Croce wrote: I need to convert (resize, and store as blob's in a mysql db) oh oh oh... NO we can slap the horse again ;D images my users can upload. I'm wondering what the best conversion tool is... I'm considering ImageMagick... Is this the best? consider using something you know for starters, then expand? as for the question itself, yes is it the best? anyone? Best is subjective, does it work the best? IMO yes, it's the best tool, but keep in mind, this makes your script less portable, not all hosts will allow you to run the 'convert' binary, nor will all installations have it readily available (Windows doesn't come with ImageMagick by default). It works the best for the applications I've written so far, but the PHP gd functions are just as powerful and probably more portable.. so without knowing all your requirements, it's hard to give a definitive answer :). as I run my own host... I solely asking for the quality. pnmscale and cjpeg is the tools currently in use. Is their anything that is integrated with PHP itself? td -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion... OT!
I've been using ImageMagick pretty much since 1997, I'm probably biased or ignorant of other tools that are probably available to people these days :). But, ImageMagick still works wonderfully for me, so.. yes it's the best :). Børge Holen wrote: On Saturday 08 September 2007 13:59, Vidyut Luther wrote: Børge Holen wrote: On Saturday 08 September 2007 12:48, Tony Di Croce wrote: I need to convert (resize, and store as blob's in a mysql db) oh oh oh... NO we can slap the horse again ;D images my users can upload. I'm wondering what the best conversion tool is... I'm considering ImageMagick... Is this the best? consider using something you know for starters, then expand? as for the question itself, yes is it the best? anyone? Best is subjective, does it work the best? IMO yes, it's the best tool, but keep in mind, this makes your script less portable, not all hosts will allow you to run the 'convert' binary, nor will all installations have it readily available (Windows doesn't come with ImageMagick by default). It works the best for the applications I've written so far, but the PHP gd functions are just as powerful and probably more portable.. so without knowing all your requirements, it's hard to give a definitive answer :). as I run my own host... I solely asking for the quality. pnmscale and cjpeg is the tools currently in use. Is their anything that is integrated with PHP itself? td -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Conversion...
This one time, at band camp, Tony Di Croce [EMAIL PROTECTED] wrote: I need to convert (resize, and store as blob's in a mysql db) images my users can upload. I'm wondering what the best conversion tool is... I'm considering ImageMagick... Is this the best? Is their anything that is integrated with PHP itself? td http://phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Information
Steve Marquez wrote: I am trying to get information (width, height, file size) from an image before it is uploaded. Is there a way to do that? Not without using a client-side technology. PHP can't help you on the client-side. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Information
Steve Marquez escreveu: Greetings, I am trying to get information (width, height, file size) from an image before it is uploaded. Is there a way to do that? Thank you, -- Steve Marquez array getimagesize ( string file_image_name ) http://www.educar.pro.br/en/a/gdlib/index.php?pn=22tr=97 -- 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
Re: [PHP] Image Information
zerof wrote: Steve Marquez escreveu: Greetings, I am trying to get information (width, height, file size) from an image before it is uploaded. Is there a way to do that? Thank you, -- Steve Marquez array getimagesize ( string file_image_name ) http://www.educar.pro.br/en/a/gdlib/index.php?pn=22tr=97 Won't work *before* it is uploaded. Please read the question. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Information
zerof wrote: Steve Marquez escreveu: Greetings, I am trying to get information (width, height, file size) from an image before it is uploaded. Is there a way to do that? Thank you, -- Steve Marquez array getimagesize ( string file_image_name ) http://www.educar.pro.br/en/a/gdlib/index.php?pn=22tr=97 I think you missed the part where he said before it is uploaded -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Information
Stut escreveu: zerof wrote: Steve Marquez escreveu: Greetings, I am trying to get information (width, height, file size) from an image before it is uploaded. Is there a way to do that? Thank you, -- Steve Marquez array getimagesize ( string file_image_name ) http://www.educar.pro.br/en/a/gdlib/index.php?pn=22tr=97 Won't work *before* it is uploaded. Please read the question. -Stut Sorry... I think this can be useful: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1catid=7threadid=1272318enterthread=y http://us3.php.net/manual/en/features.file-upload.php -- 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
Re: [PHP] Image Resize with LibGD
On 5/8/07, Christian Haensel [EMAIL PROTECTED] wrote: Now, let's say I have a small image and would like to stretch it by 50 to 100% of its original size... I know there will be a loss of quality. But maybe someone out there has had to deal with the same before and knows the best way to do that? Create a new image resource with imagecreatetruecolor(); then copy your source image into it using imagecopyresampled(), adjusting your size to whatever you need. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Resize with LibGD
On Tue, May 8, 2007 3:17 am, Christian Haensel wrote: I am using imagecreatetruecolor() and imagecopyresampled() to resize oversized images and am overlaying them with an transparent PNG to add a watermark. That works just well for oversized images. Now, let's say I have a small image and would like to stretch it by 50 to 100% of its original size... I know there will be a loss of quality. But maybe someone out there has had to deal with the same before and knows the best way to do that? I suspect you'll never be totally happy with the result of stretching an image... You're basically attempting to re-construct lost pixel data that simply isn't there... In my limited experience, you're almost always better off just leaving the image alone rather than expanding it. You can make it bigger by framing it centered in a larger image of transparent pixel border, and then your watermark will blot out huge chunks of it, perhaps, but it will layout okay, and at least the bits of image one can see aren't all chunky/ugly. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image uploading/resizing best practices in PHP
On 3/22/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I would like to make a script to upload a jpg filewith php to a server; then make a thumb; save if for later use. And store the path to the image in a database to display it later. But what is the best practice to do this on a relatively low traffic website? I dont know where to begin but I have 2 appoaches: 1. To make a script to upload the image and resize this on the fly and store only the thumb image somewhere for later use. While also to store the image path in de database for later retrieval. The best way i think if you have enough space on the server to store the thumb. 2. to make a script to only upload the image as is and then insert the image path in the database for later use. And upon displaying the image to use like a nondistructive img scr=resizer.php?imgfile=image.jpgwidth=250 border=0 resizer to display the image in the desired dimentions. This one is worser then the first one, because everytime you request the thumb would cost some CPU power. This isn't a lot, but if you are gonna process 1000s thumbs a time, it will really make difference in performance. Which one would be the best practice now a days for a relative low traffic site? I really have no idean how to build this but I have a good approach I maybe could start searching for something more specific. Thanks for your help, Dwayne You should have a look at the image functions of PHP(www.php.net/image). Creating the thumbs is the hardest part. The upload part should be no problem with a little bit of google :) Or you might want to google for a full working scripts, i saw them around. Tijnema -- 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] image uploading/resizing best practices in PHP
Option one is much better. -- Shafiq Rehman (ZCE) http://phpgurru.com | http://shafiq.pk On 3/22/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/22/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I would like to make a script to upload a jpg filewith php to a server; then make a thumb; save if for later use. And store the path to the image in a database to display it later. But what is the best practice to do this on a relatively low traffic website? I dont know where to begin but I have 2 appoaches: 1. To make a script to upload the image and resize this on the fly and store only the thumb image somewhere for later use. While also to store the image path in de database for later retrieval. The best way i think if you have enough space on the server to store the thumb. 2. to make a script to only upload the image as is and then insert the image path in the database for later use. And upon displaying the image to use like a nondistructive img scr=resizer.php?imgfile=image.jpgwidth=250 border=0 resizer to display the image in the desired dimentions. This one is worser then the first one, because everytime you request the thumb would cost some CPU power. This isn't a lot, but if you are gonna process 1000s thumbs a time, it will really make difference in performance. Which one would be the best practice now a days for a relative low traffic site? I really have no idean how to build this but I have a good approach I maybe could start searching for something more specific. Thanks for your help, Dwayne You should have a look at the image functions of PHP(www.php.net/image). Creating the thumbs is the hardest part. The upload part should be no problem with a little bit of google :) Or you might want to google for a full working scripts, i saw them around. Tijnema -- 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] image uploading/resizing best practices in PHP
thx for the input. I was afraid that it would be option 1 because it is more complex. I will start googling. ;) Thx Shafiq Rehman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Option one is much better. -- Shafiq Rehman (ZCE) http://phpgurru.com | http://shafiq.pk On 3/22/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/22/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I would like to make a script to upload a jpg filewith php to a server; then make a thumb; save if for later use. And store the path to the image in a database to display it later. But what is the best practice to do this on a relatively low traffic website? I dont know where to begin but I have 2 appoaches: 1. To make a script to upload the image and resize this on the fly and store only the thumb image somewhere for later use. While also to store the image path in de database for later retrieval. The best way i think if you have enough space on the server to store the thumb. 2. to make a script to only upload the image as is and then insert the image path in the database for later use. And upon displaying the image to use like a nondistructive img scr=resizer.php?imgfile=image.jpgwidth=250 border=0 resizer to display the image in the desired dimentions. This one is worser then the first one, because everytime you request the thumb would cost some CPU power. This isn't a lot, but if you are gonna process 1000s thumbs a time, it will really make difference in performance. Which one would be the best practice now a days for a relative low traffic site? I really have no idean how to build this but I have a good approach I maybe could start searching for something more specific. Thanks for your help, Dwayne You should have a look at the image functions of PHP(www.php.net/image). Creating the thumbs is the hardest part. The upload part should be no problem with a little bit of google :) Or you might want to google for a full working scripts, i saw them around. Tijnema -- 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] image uploading/resizing best practices in PHP
2007. 03. 22, csütörtök keltezéssel 12.48-kor Dwayne Heronimo ezt írta: thx for the input. I was afraid that it would be option 1 because it is more complex. why would resizing and then storing it be more complex than resizing and then displaying it? greets Zoltán Németh I will start googling. ;) Thx Shafiq Rehman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Option one is much better. -- Shafiq Rehman (ZCE) http://phpgurru.com | http://shafiq.pk On 3/22/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/22/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I would like to make a script to upload a jpg filewith php to a server; then make a thumb; save if for later use. And store the path to the image in a database to display it later. But what is the best practice to do this on a relatively low traffic website? I dont know where to begin but I have 2 appoaches: 1. To make a script to upload the image and resize this on the fly and store only the thumb image somewhere for later use. While also to store the image path in de database for later retrieval. The best way i think if you have enough space on the server to store the thumb. 2. to make a script to only upload the image as is and then insert the image path in the database for later use. And upon displaying the image to use like a nondistructive img scr=resizer.php?imgfile=image.jpgwidth=250 border=0 resizer to display the image in the desired dimentions. This one is worser then the first one, because everytime you request the thumb would cost some CPU power. This isn't a lot, but if you are gonna process 1000s thumbs a time, it will really make difference in performance. Which one would be the best practice now a days for a relative low traffic site? I really have no idean how to build this but I have a good approach I maybe could start searching for something more specific. Thanks for your help, Dwayne You should have a look at the image functions of PHP(www.php.net/image). Creating the thumbs is the hardest part. The upload part should be no problem with a little bit of google :) Or you might want to google for a full working scripts, i saw them around. Tijnema -- 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] image digit to check password
Om On 3/20/07, Jochem Maas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/20/07, Dave Goodchild [EMAIL PROTECTED] wrote: Have a look at this: Have a look at nothing :) I believe this Dave's way of pointing people to the Great Void :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk
RE: [PHP] image digit to check password
[snip] 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 ? [/snip] Google captcha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image digit to check password
On 3/20/07, Alain Roger [EMAIL PROTECTED] 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, The program itself is called CAPTCHA, you can of course look at their source. But in simple i can tell you how it works, it just creates the image with the PHP image functions, and saves a reference to which code used in session variable. Later this reference is checked with the code entered. In most cases the code in the image is MD5 encrypted and stored in the session. Then after submitting, the code entered is also MD5 encrypted and checked with the one in the session. Tijnema -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image digit to check password
- Original Message - From: Jay Blanchard [EMAIL PROTECTED] [snip] 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 ? [/snip] Google captcha Not that long ago, your reply would have been considered gibberish Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image digit to check password
Have a look at this: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image digit to check password
On 3/20/07, Dave Goodchild [EMAIL PROTECTED] wrote: Have a look at this: Have a look at nothing :) -- 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] image digit to check password
Tijnema ! wrote: On 3/20/07, Dave Goodchild [EMAIL PROTECTED] wrote: Have a look at this: Have a look at nothing :) I believe this Dave's way of pointing people to the Great Void :-) -- 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] image digit to check password
On Tue, March 20, 2007 11:52 am, Alain Roger wrote: 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 ? Search for the term CAPTCHA in Google. Add in PHP to get just PHP solutions. You will find LOTS. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image from a secure site
2007/3/12, Richard Lynch [EMAIL PROTECTED]: Instead of trying to re-invent the authentication wheel, just use http://php.net/curl wow!! Thanks you A LOOOT!!! thats amazing!!! On Thu, March 8, 2007 4:51 pm, Manolet Gmail wrote: hi, i install 4 IP cameras and i want to extract the images from their web interface that is protected be a username and password (HTTP AUTH) and show it into another system. so i do a function to connect to it and get the image... function subd($host,$port,$ownername,$passw,$request) { $sock = fsockopen($host,$port); if(!$sock) { print('Socket error'); exit(); } $authstr = $ownername:$passw; $pass = base64_encode($authstr); $in = GET $request\r\n; $in .= HTTP/1.0\r\n; $in .= Host:$host\r\n; $in .= Authorization: Basic $pass\r\n; $in .= \r\n; fputs($sock, $in); while (!feof($sock)) { $result .= fgets ($sock,128); } fclose( $sock ); return $result; } and next i want to print it into the browser.. $request = /IMAGE.JPG?cidx=20072261649239281; $result = subd('contelec.sytes.net',2002,invitado,invitado,$request); header ('Content-type: image/jpeg'); imagejpeg($result); exit(); but doesnt work if you want to check the cam you can go to http://contelec.sytes.net:2002 the username is invitado and the password is invitado. please help me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image from a secure site
Well in case someone need to do this... this is the code.. very easy at all.. header ('Content-type: image/jpeg'); $ch =curl_init(http://contelec.sytes.net:2002/IMAGE.JPG?cidx=20072261649239281;); curl_setopt($ch,CURLOPT_USERPWD,invitado:invitado); curl_exec($ch); curl_close($ch); 2007/3/13, Manolet Gmail [EMAIL PROTECTED]: 2007/3/12, Richard Lynch [EMAIL PROTECTED]: Instead of trying to re-invent the authentication wheel, just use http://php.net/curl wow!! Thanks you A LOOOT!!! thats amazing!!! On Thu, March 8, 2007 4:51 pm, Manolet Gmail wrote: hi, i install 4 IP cameras and i want to extract the images from their web interface that is protected be a username and password (HTTP AUTH) and show it into another system. so i do a function to connect to it and get the image... function subd($host,$port,$ownername,$passw,$request) { $sock = fsockopen($host,$port); if(!$sock) { print('Socket error'); exit(); } $authstr = $ownername:$passw; $pass = base64_encode($authstr); $in = GET $request\r\n; $in .= HTTP/1.0\r\n; $in .= Host:$host\r\n; $in .= Authorization: Basic $pass\r\n; $in .= \r\n; fputs($sock, $in); while (!feof($sock)) { $result .= fgets ($sock,128); } fclose( $sock ); return $result; } and next i want to print it into the browser.. $request = /IMAGE.JPG?cidx=20072261649239281; $result = subd('contelec.sytes.net',2002,invitado,invitado,$request); header ('Content-type: image/jpeg'); imagejpeg($result); exit(); but doesnt work if you want to check the cam you can go to http://contelec.sytes.net:2002 the username is invitado and the password is invitado. please help me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image from a secure site
Instead of trying to re-invent the authentication wheel, just use http://php.net/curl On Thu, March 8, 2007 4:51 pm, Manolet Gmail wrote: hi, i install 4 IP cameras and i want to extract the images from their web interface that is protected be a username and password (HTTP AUTH) and show it into another system. so i do a function to connect to it and get the image... function subd($host,$port,$ownername,$passw,$request) { $sock = fsockopen($host,$port); if(!$sock) { print('Socket error'); exit(); } $authstr = $ownername:$passw; $pass = base64_encode($authstr); $in = GET $request\r\n; $in .= HTTP/1.0\r\n; $in .= Host:$host\r\n; $in .= Authorization: Basic $pass\r\n; $in .= \r\n; fputs($sock, $in); while (!feof($sock)) { $result .= fgets ($sock,128); } fclose( $sock ); return $result; } and next i want to print it into the browser.. $request = /IMAGE.JPG?cidx=20072261649239281; $result = subd('contelec.sytes.net',2002,invitado,invitado,$request); header ('Content-type: image/jpeg'); imagejpeg($result); exit(); but doesnt work if you want to check the cam you can go to http://contelec.sytes.net:2002 the username is invitado and the password is invitado. please help me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image storing
[snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image storing
This dude is just trying to start another skirmishand probably a riot. On Monday 05 March 2007 19:50, Jay Blanchard wrote: [snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image storing
On Mon, 2007-03-05 at 20:55 +0100, Børge Holen wrote: This dude is just trying to start another skirmishand probably a riot. Well he didn't ask about filesystems, so if everyone keeps it on topic there shouldn't be an issue ;) On Monday 05 March 2007 19:50, Jay Blanchard wrote: [snip] Can you recommend the best way to store an image into the MySQL database and optimze it. And display and manipulate that image in PHP. [/snip] There are many tutorials; http://www.google.com/search?hl=enq=store+image+in+database+PHP Personally, I've always found INSERT works well for storing pretty much any kind of data into a MySQL database. It also helps to properly quote the data. I've heard tell of a non standard keyword called REPLACE that can store the information also regardless of whether an existing entry exists for any defined primary key. f an entry already exists within a table having a defined primary key, then I'd strongly favour the UPDATE syntax. :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image storing
At 8:55 PM +0100 3/5/07, Børge Holen wrote: This dude is just trying to start another skirmishand probably a riot. Was there something I missed. :-) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload
Robert Fitzpatrick wrote: I have a small application that ran on one server and now gives me a problem with uploading images on a new server. I am running PHP 4.4.4 now on this server and hoping it is just something that needs adjusted in php.ini, but cannot seem to find. The file is posted as a file fields in a multipart/form-data form, the application tests the file with getimagesize() shown below. I am getting the die response in the browser. I tried echo of the file and it prints a random file name under the /tmp directory on this CentOS Linux system. If I sleep for 10 seconds, the file gets created and gone after the script finishes. Can someone suggest what my problem may be? no. but start by stopping the assumption that getimagesize() returns something equivelant to false to mean the same thing as that the file does not exist (or is not an image file.) this might help: http://php.net/is_uploaded_file also check it's not a permissions issue (i.e. the file is being created but the webserver cannot subsequently read the file) if (!getimagesize($_FILES['filPhoto']['tmp_name'])) { die('The file you are attempting to upload is not an image file.'); } else { snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload
Jochem Maas wrote: Robert Fitzpatrick wrote: I have a small application that ran on one server and now gives me a problem with uploading images on a new server. I am running PHP 4.4.4 now on this server and hoping it is just something that needs adjusted in php.ini, but cannot seem to find. The file is posted as a file fields in amultipart/form-data form, the application tests the file with getimagesize() shown below. I am getting the die response in the browser. I tried echo of the file and it prints a random file name under the /tmp directory on this CentOS Linux system. If I sleep for 10 seconds, the file gets created and gone after the script finishes. Can someone suggest what my problem may be? no. but start by stopping the assumption that getimagesize() returns something equivelant to false to mean the same thing as that the file does not exist (or is not an image file.) this might help: http://php.net/is_uploaded_file Yes, actually that is done first, the getimagesize is used it the script to test it as an image. This was written by someone else and worked prior to moving servers. This is a more complete snippet of the code: if (is_uploaded_file($_FILES['filPhoto']['tmp_name'])) { // use getimagesize to make sure it's an image file if (!getimagesize($_FILES['filPhoto']['tmp_name'])) { die('The file you are attempting to upload is not an image file.'); snip also check it's not a permissions issue (i.e. the file is being created but the webserver cannot subsequently read the file) The /tmp directory where it is created is set with 777 perms. I have not checked the destination, but the script does not appear to get back the above point, giving us the die response. -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload
On Mon, February 5, 2007 4:29 pm, Robert Fitzpatrick wrote: I have a small application that ran on one server and now gives me a problem with uploading images on a new server. I am running PHP 4.4.4 now on this server and hoping it is just something that needs adjusted in php.ini, but cannot seem to find. The file is posted as a file fields in a multipart/form-data form, the application tests the file with getimagesize() shown below. I am getting the die response in the browser. I tried echo of the file and it prints a random file name under the /tmp directory on this CentOS Linux system. If I sleep for 10 seconds, the file gets created and gone after the script finishes. Can someone suggest what my problem may be? The file always goes away when the script finishes. See: http://php.net/move_uploaded_file if (!getimagesize($_FILES['filPhoto']['tmp_name'])) { die('The file you are attempting to upload is not an image file.'); Try various things like file_exists on the file to see if you are getting the file at all. fopen/fread the first N bytes and compare them to what you are uploading, to see if the data that gets there is the data you sent. getimagesize() only reads the first N bytes and then interprets that to decide what kind of file it is, and how big the width/height are, etc. I dunno exactly what N is, but it's relatively small. Different file formats have different size N, and PHP has to figure out what to do for all of them, so maybe it just reads the largest N, or maybe it reads a few bytes and then decides how many to read for the rest of the meta-info. At any rate, if you can fread a couple hundred bytes, and it matches what you uploaded, then you know that something is wrong with the original image and getimagesize() -- You could FTP it up just like your logo or buttons, and use getimagesize() on it, and it STILL wouldn't work. Actually, that's another good test to run: FTP the file up to your images directory and see what getimagesize does on that. } else { snip -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload
PS I forgot that the $_FILES array also has an 'error' field in it. Check that! On Mon, February 5, 2007 4:29 pm, Robert Fitzpatrick wrote: I have a small application that ran on one server and now gives me a problem with uploading images on a new server. I am running PHP 4.4.4 now on this server and hoping it is just something that needs adjusted in php.ini, but cannot seem to find. The file is posted as a file fields in a multipart/form-data form, the application tests the file with getimagesize() shown below. I am getting the die response in the browser. I tried echo of the file and it prints a random file name under the /tmp directory on this CentOS Linux system. If I sleep for 10 seconds, the file gets created and gone after the script finishes. Can someone suggest what my problem may be? if (!getimagesize($_FILES['filPhoto']['tmp_name'])) { die('The file you are attempting to upload is not an image file.'); } else { snip -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image commands (again)
On Sun, November 5, 2006 4:31 pm, Ron Piggott (PHP) wrote: I created a form that I have on my site --- it is at http://www.actsministrieschristianevangelism.org/development_tools/textart/details.html If I run this script it creates a graphic image of the text the user typed in with the appropriate options selected I would now like to have the image created to have some HTML around it ... I would like to have some text above the image and following it. How do I do this in PHP? I would like something like . . . Content-type: image/ the browser expects only the image to output to the screen and no HTML You can't get it to work because you are not thinking the Right Way :-) A single HTTP request can return an HTML document, *or* it can return an IMAGE, but it can't do both. [*] You *could* do something like this, however: ?php $_CLEAN['text'] = preg_replace('/[[:alnum:]]/', '', $_REQUEST['text']); ? html headtitlerequired by w3c/title/head body pThe text you typed was: ?php echo $_CLEAN['text']?/p img src=image_maker.php?text=?php echo urlencode($_CLEAN['text'])? / pThanks you for using our service./p /body /html It seems like your existing solution DOES this already. There's no way to do it as a single HTTP request, though. [*] [*] Technically, you *can* embed the image data in the HTTP HTML output stream, but it's very cludgy, doesn't scale well, usually, and not supported well by all (ancient) browsers. Don't do that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image commands (again)
On 05 Nov 2006, at 15:31 , Ron Piggott (PHP) wrote: Content-type: image/ the browser expects only the image to output to the screen and no HTML As if should. Save the image in a temporary location and then send html that include and img ... / tag -- Though it's cold and lonely in the deep dark night I can see paradise by the dashboard light. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image commands (again)
Google Kreme wrote: On 05 Nov 2006, at 15:31 , Ron Piggott (PHP) wrote: Content-type: image/ the browser expects only the image to output to the screen and no HTML As if should. Save the image in a temporary location and then send html that include and img ... / tag You don't need to do that. You can just call the PHP script directly from the img tag. Your only problem is how to pass the parameters. You obviously can't do a POST request from the img tag, so you either need to pass the parameters as part of the url as in: img src=image.php?text=foosize=10 / Or you use a cookie-based mechanism like a PHP session and refer to that from the image.php script. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image protection
On 10/6/06, tedd [EMAIL PROTECTED] wrote: Hi gang: What would be the best way to protect images in a directory from being harvested? I know that when an image is shown to the user, while there are some javascript tricks to deter the user, there is no real way to stop the user from capturing the image, for they already have it. But, is there a way to protect a directory such that an application such as SightSucker (nice program btw), can't retrieve it's contents, while your php script can? Thanks. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could try http://alistapart.com/articles/hotlinking. Another way that you could do it is setting a session variable on the page that you know your images are going to be viewed from. Then on the script that your images are linked in through (via page.php?image=x) check for that session variable. At least with this second method it forces the robot to accept a session cookie. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image protection
lurkin' around trying to keep images from others, while still have them shown on yer own page seems a bit futile. watermark 'em. other stuff to do is use flash witch I've never done. (due to PPC restrictions) I've done some of this auto open/close windowing js, witch also includes rightclick disable inside the window; inserting an 1x1 gif ontop, keeping ppl away from direct access of the opened php file with a check of witch location it was accessed from. Insert no-cache in the metadata. This worked on every browser except Opera, witch have some option to disable JS without loosing focus from an window. whereas the gif came in handy This worked on none to eager ppl, while on the other hand; If this image popup was run one time. it could be used one time directly from the address bar due to the browser cache or the session in witch the script were accessed, dunno. Anyone know? Say, stay with WM. On Friday 06 October t2006 19:44, tedd wrote: Hi gang: What would be the best way to protect images in a directory from being harvested? I know that when an image is shown to the user, while there are some javascript tricks to deter the user, there is no real way to stop the user from capturing the image, for they already have it. But, is there a way to protect a directory such that an application such as SightSucker (nice program btw), can't retrieve it's contents, while your php script can? Thanks. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image protection
On Fri, October 6, 2006 12:44 pm, tedd wrote: What would be the best way to protect images in a directory from being harvested? Tell the client that correctly linked and tagged images INCREASE traffic because the search engines can find them and suck people in, so hiding them is a Bad Idea. :-) But, is there a way to protect a directory such that an application such as SightSucker (nice program btw), can't retrieve it's contents, while your php script can? But it this way: You can erect as many barriers as you like. Some of them will stop some automated scripts. Many of them will stop legitimate use. Most of them will incovenience legitimate users. None of them will stop a determined writer of an automated script. [irony] I type this message as my PHP script is surfing to our site on IE in the background, trying to trigger an intermittent session disappearing bug. [/irony] -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image manipulation with php
On 8/29/06, Ross [EMAIL PROTECTED] wrote: 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 I'm not sure what you mean here. (ii) comparing and reducing the file reducing a file tends to follow the logic of some sort: $size = GetImageSize ($image); $ratio = $size[0]/$size[1]; if ($ratio 1) { $width = $max_size; $height = ($max_size/$size[0]) * $size[1]; } else { $width = ($max_size/$size[1]) * $size[0]; $height = $max_size; } where $max_size is the largest you want your image to be in width, then just copy it it into a new image create at that size There are a lot of samples of this on google as jochem suggested. Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image manipulation with php
Ross wrote: 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 why is this a problem? getimagesize() just needs a path to the image. given that this is all new to you you might consider that storing the image data directly in the DB is best left to crazy fools who really know where their towels are at. (ii) comparing and reducing the file RTFM or STFW - there are lots of examples related to image resampling/thumbnailing/etc and even more readymade scripts that do more or less what you want. Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Destroy
On 8/15/06, Tom Chubb [EMAIL PROTECTED] wrote: I know this will be really simple, but I'm struggling to get my head round the use of imagedestroy() I have some code which uploads an image, resizes to create a smaller image and thumbnail then deletes the source image. My question is which images need to be destroyed? Straight from the manual: imagedestroy() frees any memory associated with image image. image is the image identifier returned by one of the image create functions, such as imagecreatetruecolor() So any time you call imagecreate* functions you need to also do an imagedestroy. In your case you need to add imagedestroy($target_id); imagedestroy($source_id); just before imagejpeg ($target_id,$targetfile,$jpegqual); return true; } -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php