PHP: Simple upload image url to ImageShack

Filed Under (php) by The Chef on 26-04-2009

Tagged Under : , , ,

Here is a function you can use to directly upload url images to ImageShack. The function returns an associative array with 2 elements representing the ImageShack url of the image and of the thumbnail


function uploadURLToImageshack($url)
{
$ch = curl_init ( "http://www.imageshack.us/transload.php" );

$post ['xml'] = 'yes';
$post ['url'] = $url;

curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_HEADER, false );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 60 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (
'Expect: ' ) );

$result = curl_exec ( $ch );
curl_close ( $ch );

if (strpos ( $result, '<' . '?xml version="1.0" encoding="iso-8859-1"?>' ) === false)
{
return NULL;
} else
{
$xml = new SimpleXMLElement ( $result );
return array (
"image" => $xml->image_link,
"thumb" => $xml->thumb_link );
}
}

Decompiling chm files using C#

Filed Under (c#) by The Chef on 25-04-2009

Tagged Under : ,

Recently I've came across an issue: reformatting a chm file or better, converting it to a pdf. So, what's better
than your own software :)  After some research over the net, I've came with this solution:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RelatedObjects.Storage;

namespace CHMdecompiler
{
class Program
{
static void Main(string[] args)
{
ITStorageWrapper iw = new ITStorageWrapper(@"c:\WINDOWS\Help\blutooth.chm");

// Loop through collection of objects stored inside IStorage
foreach (RelatedObjects.Storage.IBaseStorageWrapper.FileObjects.FileObject fileObject in iw.foCollection)
{
// Check to make sure we can READ stream of an individual file object
if (fileObject.CanRead)
{
Console.WriteLine("Path: " + fileObject.FilePath);
Console.WriteLine("File: " + fileObject.FileName);

// FileUrl - is a external reference to the internal object
// allows you to display content of single file in Internet Explorer
// without extracting content from the archive
Console.WriteLine("Url: " + fileObject.FileUrl);

// We only want to extract HTM files in this example
// fileObject is our representation of internal file stored in IStorage

if (fileObject.FileName.EndsWith(".htm"))
{

//string fileString = fileObject.ReadFromFile();
//Console.WriteLine("Text: " + fileString);

// Direct Extraction sample
fileObject.Save(fileObject.FileName);
}
}
}
Console.ReadKey();
}
}
}

Download [IStorage wrapper]

How to make a seamless pattern in Photoshop

Filed Under (Photoshop) by The Chef on 05-10-2008

Tagged Under : , ,

Page 6 of 10« First...4567810...Last »