Jump to content

lokie538

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Everything posted by lokie538

  1. Ok ive tried new script <?php $img = ImageCreateFromJPEG('3.jpg'); $border = ImageCreateFromGIF('border.gif'); list($widthg,$heightg)=getimagesize('border.gif'); echo "Widthg: " . $widthg; echo "<br>heightg: " . $heightg; $widthj = imagesx($img); $heightj = imagesy($img); echo "<br><br>widthj: " . $widthj; echo "<br>heightj: " . $heightj; $tempio = imagecreatetruecolor($widthj, $heightj); imagecopyresampled($tempio, $img, 0, 0, 0, 0, $widthj, $heightj, $widthj, $heightj); imagecopyresampled($tempio, $border, 0, 0, 0, 0, $widthj, $heightj, $widthg, $heightg); imagejpeg($tempio,"1000.jpg",100); ?> But it does not apply the border with transparency. So ive got this as the border: http://www.lookpic.com/files/border.gif but the fade isnt transparent, when its run through it comes out with this: http://www.lookpic.com/files/10001.jpg So do you guys know a way to make it fade, as the background of the website if black so im trying to give it a feather / faded background.
  2. Ok what I did was make a border in gif format, so im trying to get it to overlay on top (its transparent in the middle). Ive tried some code but I keep getting errors. <?php $img = ImageCreateFromJPEG('2.jpg'); $border = ImageCreateFromGIF('border.gif'); list($widthg,$heightg)=getimagesize('border.gif'); $widthj = imagesx($img); $heightj = imagesy($img); $tmp = imagecreatetruecolor($widthr, $heightr); imagecopyresampled($tmp, $border, 0, 0, 0, 0, $new_widthj, $new_heightj, $widthg, $heightg); //imagecopy($tmp, $border, 0, 0, 0, 0, $widthj, $widthj); $filename = "200.jpg"; imagejpeg($border,$filename,100); ?> Hmm im not to good at the syntax, but I try to load the original picture, then load the border, resize the border so it matches the dimentions of the original picture and then apply the border over the original picture and then save it.
  3. Hi, All I can get it to do is to draw a black border..... Can anyone explain what the top code does? What I was hoping to acheive is a faded, or feather border.
  4. Can you explain what your trying to do some more? I don't understand sorry
  5. Damn it I always make simple mistakes and can never see them myself lol Thanks drisate!!
  6. Hi, Im getting an Parse error: syntax error, unexpected '}' in <?php $x = "1"; while ($x < "11") { $filename = "Gallery/workshop/" . $x . ".jpg"; if (file_exists($filename)) { echo "<img src=\"Gallery/contest/" . $id . ".jpg\" alt=\"Contest Picture\" /><br />"; } $x = ($x + 1) } // Error points to this line ?> Ive never used a while loop before so what am I doing wrong?
  7. Ok ill try it out tomoro Thanks hope it works
  8. Hi, I have a image upload script working, but I want it to automaticly upload a faded border on it. I have a black site and dont want a hard edge on the picture. Im not sure about the way to do it? Maybe make a gif with a transparent middle? Or is there a better way? Well here is my upload script atm: // This is the temporary file created by PHP $uploadedfile = $_FILES['uploadfile']['tmp_name']; $uploadedfiletype = $_FILES['uploadfile']['type']; // Create an Image from it so we can do the resize $src = imagecreatefromjpeg($uploadedfile); imagejpeg($src,"../Gallery/Original/". $newname . ".jpg",100); // Capture the original size of the uploaded image list($width,$height)=getimagesize($uploadedfile); $height_orig = $height; $width_orig = $width; // For our purposes, I have resized the image to be // 600 pixels wide, and maintain the original aspect // ratio. This prevents the image from being "stretched" // or "squashed". If you prefer some max width other than // 600, simply change the $newwidth variable // maximum height and width $width_max = "500"; $height_max = "800"; // initialize reduced dimensions $heightr = $height_orig; $widthr = $width_orig; // if height exceeds max, scale down dimensions if ($height_max < $heightr) { $heightr = $height_max; $widthr = ($height_max / $height_orig) * $width_orig; } // if width still exceeds max, further scale down dimensions if ($width_max < $widthr) { $heightr = ($width_max / $widthr) * $heightr; $widthr = $width_max; } $tmp = imagecreatetruecolor($widthr, $heightr); // this line actually does the image resizing, copying from the original // image into the $tmp image imagecopyresampled($tmp, $src, 0, 0, 0, 0, $widthr, $heightr, $width_orig, $height_orig); // now write the resized image to disk. I have assumed that you want the // resized, uploaded image file to reside in the ./images subdirectory. $filename = "../Gallery/Large/". $newname . ".jpg"; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); // NOTE: PHP will clean up the temp file it created when the request // has completed. //echo $width; //echo "<br>"; //echo $height; //echo "<br>"; $imagesize= "../Gallery/Large/". $newname . ".jpg"; list($width2,$height2)=getimagesize($imagesize); //echo $width2; //echo $height2; ///////////////////////////////// Watermark $picid = $_GET['picid']; $imagesource = "../Gallery/Large/" . $newname . ".jpg"; $filename = "../Gallery/Large/" . $newname . ".jpg"; if (!file_exists($imagesource)) die(); $filetype = strtolower(substr($imagesource,strlen($imagesource)-4,4)); if($filetype == ".gif") $image = @imagecreatefromgif($imagesource); if($filetype == ".jpg") $image = @imagecreatefromjpeg($imagesource); if($filetype == ".png") $image = @imagecreatefrompng($imagesource); if (empty($image)) die(); $watermark = @imagecreatefromgif('watermark.gif'); $imagewidth = imagesx($image); $imageheight = imagesy($image); $watermarkwidth = imagesx($watermark); $watermarkheight = imagesy($watermark); if($watermarkwidth > $imagewidth OR $watermarkheight > $imageheight) { } else { $startwidth = (($imagewidth - $watermarkwidth - 3) ); $startheight = (($imageheight - $watermarkheight) ); imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); imagejpeg($image,$filename,100); imagedestroy($image); imagedestroy($watermark);
  9. Lol yea I forgot to do or die error GAAAHHHHHH Problem was the user didnt have permission to access the database!! mysql_select_db('awesomef_pic', $cxn) or die(mysql_error()); Works fine now thanks kingphilip!!
  10. Hi, Ive written a whole site with the latest php and mysql versions, but it seems the clients host doesnt have mysql 5. So im trying to rewrite the site to work with mysql 4. Are there any good tutorials around that work with this old version? Im trying to figure out how to just show data from a table, below is the code I have atm. <?php $host="localhost"; $user="awesomef_alluser"; $passwd ="999999"; $dbname = "awesomef_pic"; $cxn = mysql_connect($host,$user,$passwd,$dbname) or die ( "Location: error.html" ); mysql_select_db('awesomef_pic', $cxn); $result = mysql_query('SELECT * FROM images'); $num = mysql_numrows($result); \\ this is so i can make a while loop to show the data mysql_close(); I get this error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in is there a mysql_fetch_array($result) that will work with mysql 4?
  11. How about making a variable with the current time and date? $dt2 = date('Y-m-d H:i:s'); $sql = "SELECT * FROM table WHERE field1 = '1' AND field2 = '0' AND field3 = '1' AND field3 >= " . $dt2 . ")"; $result = mysql_query($sql) or die (mysql_error()); $numrows = mysql_num_rows($result); if($numrows >= 1){ //I'll put code here if there are one or more rows that meet criteria }
  12. hmm im not sure what you mean? Ive made this code to rip the info off each page <?php // Get file $file = file_get_contents('file:///D:/apply.cfm.htm'); // Find main postcode preg_match('~<tr><td width="90">Postcode:</td><td><span class="style1">(.*?[^<])</span></td></tr>~i', $file, $yourpost); echo "Postcode: "; print $yourpost[1]; echo "<br>"; // Find availability status (not needed) preg_match('~<tr><td>Status:</td><td><font color="#009900"><b>(.*?[^<])</b></font></td></tr>~i', $file, $yourpost2); echo "Available: "; print $yourpost2[1]; echo "<br>"; // Find areas preg_match('#<tr><td width="90">Suburb\(s\):</td><td>([^<]+)#s', $file, $match); $arr = preg_split('#(?:\s{2,}|, )#', $match[1], -1, PREG_SPLIT_NO_EMPTY); $n = 0; $loc = ""; // String all suburbs together while(isset($arr[$n])){ $temp = strtolower($arr[$n]); $temp = ucfirst($temp); $loc = $loc . ", " . $temp; $n = $n + 1; } $loc = substr($loc, 2); echo "Area's in postcode: " . $loc; preg_match_all('~</td><td valign="top"><strong>(.*?[^<])</strong></td>~i', $file, $yourpost3); echo '<pre>'.print_r($yourpost3, true); ?> But im not sure how to bundle this into a loop, so it can record information on all the postcodes? Say instead if it reading from this file ive got mentioned up there, it should read information from the html page with postcode '4001" and then submit that form again to read from "4002". Hope you understand
  13. how about a simple, if(isset($_POST['do'])) { /// display table and such }
  14. Ok ill try and clear things up. Im trying to save all the postcode information off this page: http://www.********.net.au/apply.cfm into a database. I know how to save the information into a database once it is stored on my computer in html files. What im trying to do now is save the resulting page when say "4555" is entered. Im not sure how to do it though, say making a loop with "4555" to be entered and when it is entered to save that page as "4555.html" and then it would enter "4556" in and then save it as "4556.html". I know how to enter the postcode as "4555", but im not sure of how to loop it and save the file. Hope that helps clear it up
  15. Hi, Ok what im trying to do is automatic enter a form and then save the resulting page. The thing is I need it to enter say "1" then save the html shown. Then enter "2" then save the resulting html page. So kinda a loop, im just unsure of what syntax to use. I don'y have to use php so maybe a macro might help? Any suggestions will be appreciated
  16. Thanks for the help your a legend!! A legend of the internet!!
  17. Hi, I have to find how to remove all the white spaces and line breaks so it is just a string. For instance the output should be "cooroy, cooroy mountain, lake mcdonald, tinbeerwah" This is the output I have at the moment: COOROY, COOROY MOUNTAIN, LAKE MACDONALD, TINBEERWAH Ive tried to string replace " " with "" but there are still all the line breaks which I need to be removed. There is probably a simplified way to do this? Any suggestion guys? Ive tried looking at nl2br( but that hasn't worked either.
  18. Yep that works a treat thanks mate!!! Now I just have to find how to remove all the white spaces and line breaks so it is just a string. For instance the output should be "cooroy, cooroy mountain, lake mcdonald, tinbeerwah" Ive been looking at this http://www.gskinner.com/RegExr/ trying to understand more hehe Thanks for your help!! Edit: this kinda works to remove the white spaces! $apples = str_replace(" ", "", $match[1]); echo '<pre>'.print_r($match[1], true); echo $apples;
  19. So have you got any ideas why it wouldnt work? and failed?
  20. Hi, Im trying to extract data from a website. But for some reason its not working. This is the code on the website: <tr><td width="90">Suburb(s):</td><td> COOROY, COOROY MOUNTAIN, LAKE MACDONALD, TINBEERWAH </td></tr> and this is the code im trying to use to get it: preg_match('~<tr><td width="90">Suburb(s):</td><td>(.*?[^<])</td></tr>~i', $file, $yourpost3); print $yourpost3[1]; /// $file just uses a saved html file The bit im unsure of is (.*?[^<]) I don't know what this means? It returns this error Notice: Undefined offset: 1 in C:\wamp\www\get.php on line 15
  21. You dont put a cron job in a php script. A cron job will run a php script! I think you have to be running linux and have cron jobs installed? Ive never used one before Try google
  22. hmm i think i see what you mean. Ill try modding my code and hit it up here too see if im doing it right!
  23. Hi, I have a comment page, where there is a captcha and stuff. If something is not there like the captcha fails, it returns to the previous page. How do i send the information back (like their name and comment) to the comment page? I could use $_GET but that would be messy and huge, so how do i do it some other way? like $_POST. Im not sure how to like auto submit forms tho :/ Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.