1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Image Hosting API

Discussion in 'Products & Tools' started by johncarrera, Feb 13, 2010.

  1. #1
    Hi,
    Piczasso API code allows you to add image hosting service directly to your web-site. There are no limitations about how many images can be uploaded and also there is no need to register anywhere to get access to use API interface.
    That's the best part of it. You don't need to register anywhere and you can use Piczasso image hosting service at your site as much as you want. :)

    You can get a sample script here: http://www.piczasso.com/api_sample.zip
    Take a look at documentation, which can be found here: http://www.piczasso.com/api.php

    This is simple example how to use piczasso API:
    
    <?php
    /* 
    Simple sample script which uses Piczasso API
    Documentation about PicZasso API can be found here: http://www.piczasso.com/api.php
    */
    
    if(isset($_GET["image"])){
    	/* API sends output in JSON format */
    	$image = json_decode(rawurldecode($_GET["image"]), true);
    	/*
    	$image array includes information about the image URL and sample links to it:
    		$image["direct"] = Image URL
    		$image["thumb"] = Thumbnail URL
    		$image["image_page"] = Link to image
    		$image["bbcode"] = bbcode for forums
    		$image["html"] = html code
    	Sample table below with image links.
    	*/
    	$image["html"] = str_replace("+", "&nbsp;", htmlentities($image["html"]));
    	echo "
    	<img src=\"{$image["thumb"]}\" alt=\"\" />
    	<table>
    		<tr><td>HTML for Websites:</td><td><input type=\"text\" name=\"html\" value=\"{$image["html"]}\" /></td></tr>
    		<tr><td>IMG Code for Forums:</td><td><input type=\"text\" name=\"html\" value=\"{$image["bbcode"]}\" /></td></tr>
    		<tr><td>URL for E-Mail:</td><td><input type=\"text\" name=\"html\" value=\"{$image["image_page"]}\" /></td></tr>
    		<tr><td>Direct Link for Layouts:</td><td><input type=\"text\" name=\"html\" value=\"{$image["direct"]}\" /></td></tr>
    	</table>
    	";
    } else {
    	if(isset($_GET["error"])){
    	/* Possible errors. Complete error list: http://www.piczasso.com/api_errorcodes.txt */
    		$errorcodes = array(
    			1000 => "No image selected",
    			1001 => "Image failed to upload",
    			1002 => "Invalid image type",
    			1003 => "Image is larger than 16MB",
    			1004 => "Cannot read image info",
    			1005 => "Upload failed during process",
    			1006 => "Database error",
    			1007 => "Banned IP"
    		);
    		echo $errorcodes[$_GET["error"]];
    	}
    	/* Sample upload form below. Image can be resized also by sending for example this kind of fields:
    		<tr><td>Resize x:</td><td><input type=\"text\" name=\"size_x\"/></td></tr>
    		<tr><td>Resize y:</td><td><input type=\"text\" name=\"size_y\"/></td></tr>
    	*/ 
    	echo "
    	<form action=\"http://piczasso.com/api_handler.php\" method=\"post\" enctype=\"multipart/form-data\">
    	<table>
    		<tr><td>File:</td><td><input type=\"file\" name=\"file\" /></td></tr>
    		<tr><td>Tags:</td><td><input type=\"text\" name=\"tags\"/></td></tr>
    		<tr><td>Resize:</td><td>
    		<select name=\"size\">
    			<option value=\"1\" selected=\"selected\" >None</option>
    			<option value=\"2\" >100x75 Avatar</option>
    			<option value=\"3\" >150x112 Thumbnail</option>
    			<option value=\"4\" >320x240 Websites</option>
    			<option value=\"5\" >640x480 For forums</option>
    			<option value=\"6\">800x600 15-inch monitor</option>
    			<option value=\"7\" >1024x768 17-inch monitor</option>
    		</select></td></tr>
    		<tr><td><input type=\"submit\" value=\"send\" /></td></tr>
    	</table>
    	</form>
    	";
    }
    ?>
    
    PHP:
    Regards,
    John
     
    johncarrera, Feb 13, 2010 IP
  2. -Cash-

    -Cash- Active Member

    Messages:
    894
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    80
    #2
    This is very good update to piczasso:)
     
    -Cash-, Feb 17, 2010 IP
  3. -Cash-

    -Cash- Active Member

    Messages:
    894
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Anyone tested?
     
    -Cash-, Feb 20, 2010 IP
  4. MrHacker

    MrHacker Peon

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    where can we get the full script
     
    MrHacker, Feb 23, 2010 IP
  5. johncarrera

    johncarrera Member

    Messages:
    177
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #5
    johncarrera, Feb 23, 2010 IP