php

PHP/GD - Cropping and Resizing Images

I've coded a function that crops an image to a given aspect ratio and finally then resizes it and outputs it as JPG: <?php function Image($image, $crop = null, $size = null) { $image = ImageCreateFromString(file_get_contents($image)); if (is_resource($image) === true) { $x = 0; $y = 0; $width = imagesx($imag...

Crop or mask an image into a circle

What is the best way to crop or mask an image into a circular shape, using either ImageMagick or GD libraries? (Note, solution exists on "other" Q&A sites, but not StackOverflow) ...

Why does working permisson of PHP script differs between server?

<?PHP print "hello"; ?> I write this code and save as "1.php"; Then I upload this PHP script to my server. I have 8 diffrent free hosting server's accounts. And I noticed that there are 2 types of server settings. (1) "type A" for exapmle, sqweebs. We need to set the PHP file permission as 640. This means that sqweebs server req...

Meaning of $this-> in CakePHP

What does $this-> mean in CakePHP? Please answer this in two parts... What does $this refer to? What does -> refer to? Can someone explain each part explicitly in terms of the statement $this->Post->find('all'); in the Post controller. Why do you need the ->Post part if it is in the Posts controller? ...

How are persistent database connections stored in PHP?

As stated in the documentation on sqlite_popen php tries to make use of a persistent resource mechanism. Where is this mechanism described in detail? Is it possible to view all resources currently stored/used? Is it possible to access this mechanism and store/read other values? ...

How does the '&' symbol in PHP affect the outcome?

I've written and played around with alot of PHP function and variables where the original author has written the original code and I've had to continue on developing the product ie. Joomla Components/Modules/Plugins and I've always come up with this question: How does the '&' symbol attached to a function or a variable affect the outcom...

wordpress doctype question?

how can I code in the following code into a wordpress site without the code causing an error with the php coding thanks. <?xml version="1.0" encoding="utf-8" ?> ...

dynamically set number of form instances and save all as csv using php

Im working on a php script to take an existing csv file (we'll call this one the template) and open it in a page and populate editable text fields with it's data between 1 and 50 times(user decides how many), which once edited to the users wishes, can then all be saved into a single combined csv file, separate from the template. I inclu...

PHP - list() query not working

Hello, When I run the code below when $entry = miami.com, I get the following error message: SELECT COUNT(*) FROM # check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 It looks like I'm not correctly defining $table. Any ideas how I could do that? Thanks in advance, John ...

INTEGRATING Silverlight with PHP

Hi I have a PHP website i want to integrate it with silverlight for some rich experience ,how can i do it ,.. is it necessary to host the website on IIS if we want silverlight integration.Please suggest ways ? ...

user-friendly time entry

In my project (based on php/mysql/jquery ) i need the user to enter time. But it seems very annoying to enter the time in strict formats like 06:00 PM or 14:00 So i want to give the user freedom to enter time in a very friendly way like 6 pm, 11am etc or 14 which will then be converted internally into a strict time format for further ...

i look some example of using Swish Search Engine Extension in php

did somebody use this Extension in php or have an example of code, edit : i want to hear an opinion on this Extension if somebody deal with it. a tutorial with code , large examples .. ...

count not working on clicking the link

$file = ".$dirN/$filename."; $count_my_page = (".$dirname1/$filename.$extens"); if(fopen(".$file.","r")) { $hits = file($count_my_page); $nHits = ((int) $hits[0]) + 1; $fp = fopen($count_my_page , "w"); fputs($fp , $nHits . ""); fclose($fp); echo $nHits; ...

GD image generating bug

I'm using GD to generate images on the fly for title images on the page. There are over 100 images generated at the moment, the vast majority of which work great. Recently we found certain titles were breaking the image creation where a large horizontal space was inserted between 2 characters. The font being used for image generation i...

How to get the xml content of a node as a string?

Using PHP's DOM functions, how do you convert a DOM Node's contents into a string? <foo> Blah blah <bar baz="1">bah</bar> blah blah </foo> Given foo as the current context node, how do you get 'Blah blah <bar baz="1">bah</bar> blah blah' as a string? Using $node->textContent or $node->nodeValue just returns the text nodes, not the...

Firefox shows waiting cursor and "loading.." even after post request is complete

I have a form to upload a file.The <html> is as follows: <div id="divModalPopup" class="ui-dialog-content" style="height: 139px; width: 268px;"> <form method="post" action="upload.php" target="uploadframe" enctype="multipart/form-data"> Please choose a file to upload [only zip with shape files and no folders]: <input type="fi...

Sanitizing PHP input to ping program.

I would like to interface a php page to the linux command line program ping. I realize that there are sanitation issues. Is there a builtin library or function that can take care of everything, or will I have to rely on regex parsers? ...

Image resizing web service

Does someone know a good web service to resize images ? Either an open source (PHP/Python/Ruby) application, or a company providing a web service api. ...

Outputting image using php GD library via function call

I know that I can output an image using GD by using <img src='draw.php'> Where draw.php is a file containing the code to create an image. How can I instead output the image via a function call (I am using the Zend Framework so will be using a View Helper) rather than simply pointing to a .php file in an img tag as above? Any help g...

Validate URL with javascript and php

hi friends, I just want to validate url,for both folowing formats http://www.XYZ.com and www.XYZ.com i want this validation script in Javascript and PHP also. Thanks in advance. ...