php

Merging (watermark) a jpg with png while resizing the png in PHP GD

Hi everyone, I am sure I could somehow figure this out but it's just taking me way too long since I am not a PHP guy. Hopefully someone can set up the script for me in minutes... So here's what I need to do: I transmit 2 pictures from a smartphone to a webserver. These 2 images need to be merged (watermarked). They differ a little: p...

PHP constants undefined - but they are defined!

I'm using constants to set various configuration variables within a script. The INC_PATH constant is defined within the script that includes the class library. define('INC_PATH',$_SERVER['DOCUMENT_ROOT'].'includes/'); include('class.lib.php'); The class library contains various include('someClass.php') lines. It also contains: requ...

Perl equivalent of PHP's escapeshellarg

To escape the string to be used as shell argument we use the function escapeshellarg() in PHP. Does Perl have an equivalent function ? ...

How do I find number of submissions of a url in digg??

API documentation in Digg is totally confusing...does any one know how to count submissions for a particular URL in PHP?? some API paths that will return in XML or Json will do... ...

Workflow engine

I am new to workflow engine how it work and how I can develop it; I have A LMS (Learning management Service) site. I need to have a dynamic workflow. Can you please sugest me how I can develop it. ...

Magento custom image attribute. How do I get in frontend?

Hello, I've added an image attribute with name and label e.g. New Image, new_image. How do I fetch this from e.g. view.phtml? I thought it would be as simple as helper('catalog/image')->init($_product, 'new_image')->resize(150, 150); ?> But, this is throwing an error. Does anybody know the correct way to do this? Many thanks. ...

connect time from NGINX to PHP via FastCGI

Hi, here's a six core with 32GB ram. I've nginx 0.7.X and php5-fpm with php5.3 (from dotdeb.org). Important config files: nginx.conf user www-data; worker_processes 2; events { worker_connections 4096; } location ~ \.php$ { fastcgi_pass unix:/tmp/fcgi.sock; fastcgi_index index.php; ...

Detecting russian characters on a form in PHP

Hi, I have a site where people can submit links to sites about iPhone apps. The guy submits the application name, description, category and URL. This site has years and never received any constructive submission from a russian developer but, unfortunately it was discovered by russian spammers that annoys the hell out of me. Even with a...

printf how to do floating points with leading zeros.

I know how to do X amount of leading zeros, and I know how to do X amount of decimal points. But, how do I do them both? I am looking to have 4 leading zeros to a decimal precision of 2: 0000.00. Therefore 43.4 would be 0043.40 ...

Need to highlight overlapping text using PHP

Hi all, I am looking for means to highlight certain text on a page. I use <span class="highlight">This is a sample</span> to replace the text "This is a sample" that is found, with the help of the preg_replace function. My problem arises when there is overlapping text. If I search for the phrase "sample text" on the same page, it is no...

Zend_Session uncaught exception

So I have this in my index.php: Zend_Session::start(); Then in one of my controllers in the init method I do: if (false === isset($this->defaultNamespace->tree)) { $this->defaultNamespace->tree = array(); } Which still works. But then in action in the same controller I write this: unset($this->defaultNamespace->tree); // I tri...

post count set to 0. is this PHP fault?

hello, i have found lots of website running PHP which the post count from some hundreds back to 0. for example, a user with some hundreds of post count posting a forum topic. the loads is very slow ... and when it posted successfully, that user post count become 0. i know this is because not enough memory for PHP. all my website run...

Instantiating a AMF PHP class not working

Hi guys, I am trying to use AMF PHP to pass variables to a flash file, thus far I cannot see anything wrong with my code, but I have very little experience with creating classes, so here it goes, here is my code, index.php: <?php include "amfphp/services/flashMe.php"; $session = true; if ($session == true) { $uid = '12345'; $thi...

Facing problems in fetching the data from php web services installed in cake-php from iphone.

Hi everybody! I'm new to php and have zero exprience with the cake-php. I created the php web services, which reads data from MySql and return to my iphone app. Previously I used the same code successfully in many app, But now I'm facing the problems in it. Because the web server on which I installed my web services is cake-php based. wh...

PHPUnit: Testdependencies with test from parentclass

So, I've got a little problem with my Unittests. I wrote some basisclasses for different Testcases and I want to uses some prepared test-methods. i.e. class ModelTestCase extends PHPUnit_Framework_TestCase { public function testCreateInstance() { ... } } class UserModelTest extends ModelTestCase { /** * (at)depends testCreateIn...

Warning: fopen(C:\xampp\xampp\tmp\gra16F.tmp.svg) [function.fopen]: failed to open stream:

I have the same question with graphviz that you had: http://stackoverflow.com/questions/1721395/warning-in-image-graphviz Can you please share where to configure the tmp folder? Appreciated, Tiago Carvalho ...

cURL doesn't work from command line?

I wrote a script to parse some data from a website using cURL and it works fine when I run it in my browser, however when I want to run it in the command line I get the error "call to undefined function curl_init()". Do php scripts run under different settings from the command line? ...

Split up words but not if it contains HTML

I need a function or some regex to split up spaces in a string but to treat an HTML tag as a word. $str = 'one two <a href="">three</a> four'; $x = explode(" ", $str); print_r($x); /* Returns: Array ( [0] => one [1] => two [2] => <a [3] => href="">three</a> [4] => four ) Looking for way to return: Array ( [0...

Redbean O/RM store "date" as varchar(255) ?

From this code: $toolbox = RedBean_Setup::kickstartDev("mysql:*****************"); $r = $toolbox->getRedBean(); $test = $r->dispense("test"); $test->nom = 'Test #1'; $test->date = '2010-07-08'; $test->date_deux = '08/07/2010'; $test->num = 5; $id = $r->store( $test ); I get this SQL: CREATE TABLE IF NOT EXISTS `test` ( `id` int...

Regular expression prints one out of two in matching pattern

Hey guys, question about regex in PHP! For the given pattern, kinda like a shell terminal syntax: application>function -arg1 value -arg2 value -arg3 value -arg4 value I want to parse the arguments. This is my regex code $command=' -arg1 value -arg2 value -arg3 value -arg4 value '; // note the string begins by a space character and ...