Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Download header for image

Thursday, July 19, 2012













Below code will download image from the link stored in $main_url.This code uses curl library.
<?php
$main_url='http://24.224.243.223/axis-cgi/jpg/image.cgi?resolution=640x480&camera=1&compression=25';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$main_url);
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_POSTFIELDS,$requr);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
$err = curl_error($curl);
curl_close ($curl);
header('Content-type:image/jpeg');
header('Content-Disposition:attachment;filename="cam.jpg"');
echo $result;
?>


Happy coding :)
Continue Reading...

Strip img or HTML tag from HTML

Friday, April 6, 2012















While i was woking with Joomla Easy Blog ran into a problem where i have to get image/image link from the DB result in which all of the blog content was mixed.I used below method for that after a long session with regx and all.Happy coding. And for sure regx never helped me


$html = $row->text;
$base_url = JURI::root();
// $dom->load('test.html'); // if in a file
$dom->loadHTML($html); // if in a string

for ($i=0;
$i<$dom->getElementsByTagName('img')->length;
$i++) {
$sam = $dom->getElementsByTagName('img')->item($i)->getAttribute('src');
echo $base_url$sam ;//use this for image source

}

?>
Continue Reading...

Fancy box close after login

Saturday, November 26, 2011

One of my friend used fancybox for login.And he could not close fancy box after login.So i tried to help him and guess what i used this code to its completion.

parent.$.fancybox.close(); parent.location.reload(true);exit();
Continue Reading...

PHP

Friday, January 21, 2011

The greatest scripting language only because i started studying it from last week.For me it is gonna be me in every breath  for  coming years.Its going to define how my life going  to be based on the fact that how much efforts i am going to put on this.

        So guyz,PHP apart from the fact that i described in the above paragraph,its is  a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages.It is one of the most popular server side scripting languages running today.

There are lots of benefits of using PHP over ASP


Hosting is cheap and as I can think off

1. Because of free OS available that is Linux
2. Web server is free
3. Database is free (MySQL) and gels with it very well
4. As OS is Linux you don't pay any anti virus cost
5. Language is easy to learn and lots of resources available.


That is PHP for short.

Continue Reading...