![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
The Little Guy
-
Posts
6,675 -
Joined
-
Last visited
Posts posted by The Little Guy
-
-
you should use almost always use require_once unless you need the file to be used more than once on a page.
-
That didn't work...
It uses the color, but doesn't keep the alpha.
-
ahhh!!! good call!
-
I would like to select a color that isn't in an image, any thoughts on the best way? Maybe this isn't even the best way to do this.
I am using imagerotate, and for the 3rd parameter, I would like the uncovered area to be transparent. I have done this, but I had to use a color then make every color in the image of that color transparent. so, either what is the best way:
A. Is there a good way to do this?
B. save every pixel color in an array then loop though the array testing colors that are not in the array and setting that as the transparent value.
C. Other. What?
-
Anyone know how to convert this to php?
function IntNoise(32-bit integer: x) x = (x<<13) ^ x; return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end IntNoise function
I tried, and passing numbers to it isn't working, I am always getting 1 for a result, I should be getting anything between -1 and 1
My attempt:
function random($x){ $x = pow($x<<13, $x); return ( 1.0 - ( ($x * ($x * $x * 15731 + 789221) + 1376312589) & 0xFFFFFF) / 1073741824.0); }
-
Okay, I figured it out! My result code won't really help anyone out, so it is useless to post it. but to explain what I did, first you need to know what I am making. I am making a GD php library that supports layers (acts similar to photoshop). So what I did, was instead of making one image with a drop shadow I attached a second image to the main image, that way you can apply filters to the main image and those filters won't affect the drop shadow.
To build that image in the link:
$mg = new MagicGraphic(); $layer1 = $mg->layer(); $layer1->importFile($file); $layer1->filters("sepia"); $layer3 = $mg->layer(); $layer3->importFile($file2); $layer3->filters("autoColor"); $layer3->x = 200; $layer3->y = 20; // Next line is not apart of the layer, just attached to it: $layer3->dropshadow(20, 20, 0x000000, 50); $mg->render(RENDER_JPG, null, 50);
-
With the following code, I am making a drop shadow. The issue that I am having is in the corners where the drop shadow isn't at, their is a white box. How can I make that white box transparent?
The result I am getting: http://hostbox.us/GD/
Here is the code I am using:
public function dropshadow($x, $y, $color, $alpha = 100){ // Create an image the size of the original plus the size of the drop shadow $img = imagecreatetruecolor($this->width + $x, $this->height + $x); // Add Alpha imagealphablending($img, false); imagesavealpha($img, true); $transparent = imagecolorallocatealpha($img, 255, 255, 255, 127); // Fill the empty image with the alpha color imagefilledrectangle($img, 0, 0, $this->width + $x, $this->height + $y, $transparent); // Create a drop shadow image $drop = imagecreatetruecolor($this->width, $this->height); imagefilledrectangle($drop, 0, 0, $this->width, $this->height, $color); // Merge the 3 images into one imagecopymerge($img, $drop, $x, $y, 0, 0, $this->width, $this->height, $alpha); imagecopymerge($img, $this->img, 0, 0, 0, 0, $this->width, $this->height, 100); return $img; }
-
-
I am working with the GD Library, and I was wondering if anyone knew of a function or a way to set the transparency of a GD image (Not the final image)
What I am doing is taking an jpg image as the bottom image, then I would like to place a jpg image on top of it with 50 transparency, then flatten the image as a jpg.
I can not find anything on this, only information on setting png alpha values.
-
Sorry, but I forget how to do this, mostly because I don't do it often.
To keep things simple lets say I have 3 classes: Main, A, B
class Main{ public $classA, $classB; public $shared; public function init(){ // Do some stuff return $this; } } class A{ public function aMethod(){ $me = $this->shared; // Same value as from B::bMethod() // Do some stuff return $this; } } class B{ public function bMethod(){ $me = $this->shared; // Same value as from A::aMethod() // Do some stuff return $this; } }
$main = new Main(); $main->classA->aMethod(); $main->classB->bMethod();
I really want to be able to call the main class, then tell it what subclass to use and be able to use $this->shared in any class and it will be the same. If changed in any class the other classes should see the change as well. Does that make sense?
-
I wrote a script in ActionScript that takes an image and does color correction, giving me the same results as photoshop's "Auto Color" feature.
The actionscript uses an image matrix that looks like this:
var cmf:ColorMatrixFilter = new ColorMatrixFilter(new Array( R, 0, 0, 0, 0, 0, G, 0, 0, 0, 0, 0, B, 0, 0, 0, 0, 0, 1, 0 ));
This is different from the php GD's matrix imageconvolution, which is only 3x3 where the actionscript one is 5x4. I think this is why I am getting different image results.
Any suggestions to get the two to act the same? I am stumped...
-
I have the following jquery:
dropZone.bind("drop", function(){ });
When someone drops files on this, it currently uploads them to the server, but I would like people to also be able to drag text or URL's onto this box as well. How can I grab the text that was dropped onto the box?
-
<hr>'s are closed like this:
<hr class='red' />
pages should be as error free as possible, the less errors you have the more cross browser friendly they are.
-
use ifnull, not nullif
-
There is no php mistake, when it displays wrong in one browser but not another that is an html/css issue.
-
because the function doesn't exist, or your not including it in your code
-
I am trying to build an Html 5 / JavaScript audio player, and I can not figure out why when I press play it starts playing, then press stop and it stops, but when I press play again it plays for a few seconds then stops. Why?
Here is my click event:
$(".playPause").click(function(){ if(audio.paused){ audio.play(); $(this).css({ backgroundPosition: "-30px -30px" }); }else{ audio.pause(); $(this).css({ backgroundPosition: "-30px 0" }); } return false; });
Here is the example:
-
PHP should be set in "UTC"
echo date("g:i a", strtotime("-5 hours"));
-
I was just thinking, if your service had an API, wouldn't it be best to build the API, and use the API within the site, instead of building two separate interfaces, one for the site and one for the API...
What are your thoughts on that?
Example, it would be like facebook using their own API to build facebook. The really only difference might be that they don't have to do HTTP requests to the API.
-
but there's no way to monitor idle activity(that I know of)
ajax
-
<?php // 7200 = Time in seconds for the cookie to be active; set to "0" for it to be active until the browser closes // "/" = Where this cookie can access, currently set to root // ".site.com" = allow this cookie to access current domain and it's sub-domains; remove the first "." to only allow with in the domain and not subdomain // FALSE = This cookie doesn't require a Secure Network session_set_cookie_params(7200,"/",".site.com",FALSE); session_start(); ?>
-
If your table has more than 50, it's broken.
Where is the like button? I say that is still a high number though. Good tables have 3 or 2 columns IMO (Key, Value tables) then join them all.
-
looking at this, do you have two indexes on "id"? Your explain makes it seem that way.
I think I actually wanted this (not 100% sure why I asked for the table structure, sorry):
show indexes from adcat;
-
I am always looking for people to help in projects that I am working on, whether your a beginner or a pro in OOP programming. Like ignace, I am no expert in OOP but I do write code a beginner may not understand, but it will really boost your skills learning it if your interested you can help me in one of my current projects it will/may really boost a beginners OOP skills.
If your interested PM me.
Inserting only unique rows
in MySQL Help
Posted
This will ignore the duplicate:
or
This will update the duplicate: