Jump to content

hlstriker

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hlstriker's Achievements

Member

Member (2/5)

0

Reputation

  1. Just double tested your solution and it works fine for the example I posted. Sometimes it will be in this format too though (which is what was throwing my tests off): head:body,head:body[[one,two],[one,two],[one,two]],head:body[one,two,three],head:body Sorry about the complications.
  2. This is true, sorry for my bad example using [x,y,z]. Yes, they didn't seem to work with the brackets at all.
  3. This solution seems to work for the most part but for some reason it still splits commas inside of [] brackets sometimes. I tried to figure out why but I really don't know much as it is.
  4. I have a string that is in format like so: head:body,head:body[0,1,2],head:body[x,y,z],head:body I'm trying to split the string by the commas so it will be: head:body head:body[0,1,2] head:body[x,y,z] head:body But what I have is splitting like this: head:body head:body[0 1 2] head:body[x y z] head:body Does anyone know how I can filter out the commas inside of [] brackets?
  5. I'm wondering if it's possible to store a class object into a MySQL database? If this is possible to do, would it be better to store the class object itself - or - would it be better to store each variable in the class, and rebuild the object on retrieval?
  6. I am creating images via GD perfectly but there is only one problem. When I right click the image and click "Save image as...", the filename will be 'image.php.jpeg'. Is there a way I can make this display as only 'image.jpeg'?
  7. I think you both misunderstood my question. If you look in the example I made in Photoshop you will see the transparency bleeds through to the web page. Now if you look at the example I made with PHP GD you will see the pixels are indeed transparent, but they don't bleed through to the web page; they are only transparent enough to see the default images black background. EDIT: I figured out that I had to use: imagealphablending($png, false); imagesavealpha($png, true); Here is the final code: <?php $width = 400; $height = 400; $png = imagecreatetruecolor($width, $height); imagealphablending($png, false); imagesavealpha($png, true); $numPixels = $width * $height; $alphaPercent = 127 / $numPixels; $a = 0; for($y=0; $y<$height; $y++) { for($x=0; $x<$width; $x++) { $alphaValue = ($numPixels - $a) * $alphaPercent; $color = imagecolorallocatealpha($png, 255, 0, 0, $alphaValue); imagesetpixel($png, $x, $y, $color); $a++; } } header('Content-type: image/png'); imagepng($png); imagedestroy($png); ?> And here is an example of the output: http://hldevs.com/indexalpha/testtransparent_good.html
  8. I'm trying to make pixels fully transparent so you can see the web page background bleed through the image. The test I'm using is to make a gradient so it slowly fades to red. Here is the code I'm using: <?php $width = 400; $height = 400; $png = imagecreatetruecolor($width, $height); $numPixels = $width * $height; $alphaPercent = 127 / $numPixels; $a = 0; for($y=0; $y<$height; $y++) { for($x=0; $x<$width; $x++) { $alphaValue = ($numPixels - $a) * $alphaPercent; $color = imagecolorallocatealpha($png, 255, 0, 0, $alphaValue); imagesetpixel($png, $x, $y, $color); $a++; } } header('Content-type: image/png'); imagepng($png); imagedestroy($png); ?> The problem with this is instead of showing the web page background, it shows a black background on the image. I made an example in Photoshop to give you a better understanding of what I'm trying to accomplish. What I want: http://hldevs.com/indexalpha/testtransparent.html What I have: http://hldevs.com/indexalpha/redtest.php
  9. I'm not sure what you mean by format (png?) but I am using a color palette with all gray colors. Black to white: 0,0,0 15,15,15 50,50,50 125,125,125 255,255,255 I'm just trying to make a new 256 color palette using the old gray palette shades. So light gray is light blue, and dark gray is dark blue on the new palette.
  10. Does anyone know how to convert grayscale to a selected color? Say you have a palette ranging from black to white. Would it be possible to create a new palette based from the grayscale palette but with shades of blue instead. For instance the lighter the shade of gray, the lighter the blue will be. (the same going for the darker the shade of gray the darker the shade of blue will be). I could manually make my own blue palette but then every time I change the color I would have to create a new palette. So does anyone know how to do this dynamically?
  11. Note: Accidentally posted this in the wrong forum the first time, sorry Is it possible to get a certain palette number from a bmp image? Example: Have a 256 color bmp image. Need to find palette color 71. Color for 71 will return in Red/Green/Blue format. Any ideas?
  12. Is it possible to get the clients ping to a different server besides the web server? Example: Clients IP = 111.111.111.111 Server to ping IP = 222.222.222.222 Web servers IP = 333.333.333.333 I need this because I am running some game servers that are not on the same box as my web server and want to show the users how much ping they will get in the game servers.
  13. Is it possible to echo text before the page is finished loading? Example: echo "This text should be displayed instantly"; echo "This text should wait until the page is fully loaded to display"; I tried the following but it didn't work: ob_start(); echo "This text should be displayed instantly"; ob_flush(); flush(); echo "This text should wait until the page is fully loaded to display"; So, is this possible and if so how can I do it?
  14. I'm trying to make a script to stream a flash video. Everything works fine except the headers don't send until the script is done executing. This is bad because the script needs to throttle the bandwidth which makes the script load very slow. Is there a way to force the headers to the client browser as soon as they are called in the script? header("Content-Type: video/x-flv"); header("Content-Length: " . $fileSize); SomeForceHeaderFunction();
  15. I'm trying to check to see if the start of a new line isn't a { bracket. Here is the file layout I'm searching: And here is the pattern I'm using: preg_match("~{\n\".*(?=}\n[^{])~msU", $string, $match); So, I'm trying to get all the lines in brackets until there is not a new starting bracket. For some reason the [^{] part of the pattern seems to be the problem.
×
×
  • 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.