Skip to content
WJunction - Webmaster Forum

ImageZilla.net Curl remote upload

Status
Not open for further replies.
Hi !

I write this script :

Code:
$img_url = "http://www.wjunction.com/images/logo.png"; //// Variable with image link

$thsize = '300'; //aviable : 250,300,450,500 //[pixels]
//Dont change
$url = "http://imagezilla.net/inc/uploader.php";
$urlek = $img_url;
$post = array('url'=>'3','thefiles'=> "$urlek",'thumbsize' => "$thsize",'c_thumbsize' => '','tos'=>'agree','nonadult' => '0','prv'=>'1','submit' => 'Upload');

  $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, trim($url));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    $result = curl_exec($ch);


preg_match_all('|thumbs/(.*).jpg|',$result,$img);
///Dont change

$okladka = "http://imagezilla.net/".$img[0][0]; // img url from imagezilla.net


echo "<img src='$okladka' />";


- You can upload from link to Imagezilla.net.
 

17 comments

better to orginise the work in a function, it is useful :)
PHP:
function up2zilla {
	$thsize = '300'; //aviable : 250,300,450,500 //[pixels]
	//Dont change
	$url = "http://imagezilla.net/inc/uploader.php";
	$urlek = $img_url;
	$post = array('url'=>'3','thefiles'=> "$urlek",'thumbsize' => "$thsize",'c_thumbsize' => '','tos'=>'agree','nonadult' => '0','prv'=>'1','submit' => 'Upload');
	  $ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, trim($url));
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$result = curl_exec($ch);
	preg_match_all('|thumbs/(.*).jpg|',$result,$img);
	///Dont change
	$okladka = "http://imagezilla.net/".$img[0][0]; // img url from imagezilla.net
	return "<img src=\"$okladka\" />";
	// or //
	// return "[img]$okladka[/img]";
}

then you call it
PHP:
$img_url = "http://www.wjunction.com/images/logo.png"; //// Variable with image link
up2zilla($img_url);

that's it :)
 
thanks, jokerhacker!
But I dont know setup...

I have created a js file with the function and index file with:
Code:
[COLOR=#000000][COLOR=#0000BB]$img_url [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"http://www.wjunction.com/images/logo.png"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//// Variable with image link
[/COLOR][COLOR=#0000BB]up2zilla[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$img_url[/COLOR][COLOR=#007700]);  [/COLOR][/COLOR]
But I believe it is not correct. The index must have a form to put the links?
Please, can you give me an example how is the index for this case?
 
In jookerhacker function, there is No variable in function nor any () :|

Therefore:

PHP:
<?php

function up2zilla($url, $thesize = '450') {
    $urlup = "http://imagezilla.net/inc/uploader.php";
    $post = array('thefiles'=> "$url",'thumbsize' => "$thesize", 'tos'=>'agree', 'prv'=>'1');
    $ch = curl_init(trim($urlup));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    echo $result;
    preg_match_all('|thumbs/(.*).jpg|',$result,$img);
    $okladka = "http://imagezilla.net/".$img[0][0]; // img url from imagezilla.net
    return $okladka;
}

$thsize = '450'; //aviable : 250,300,450,500 //[pixels]    
$img_url = "http://static.iptorrents.com/ipt/banners/eid.jpg"; //// Variable with image link
$imglink = up2zilla($img_url, $thsize);  //This will get the direct image link

echo "<img src='$imglink' />"; // Outputs image to show in webbrowser
echo "<br /> <input size='50' value='$imglink'></input>"; // Outputs the image link in a input box

?>

thanks, jokerhacker!
But I dont know setup...

I have created a js file with the function and index file with:
Code:
[COLOR=#000000][COLOR=#0000BB]$img_url [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"http://www.wjunction.com/images/logo.png"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//// Variable with image link
[/COLOR][COLOR=#0000BB]up2zilla[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$img_url[/COLOR][COLOR=#007700]);  [/COLOR][/COLOR]
But I believe it is not correct. The index must have a form to put the links?
Please, can you give me an example how is the index for this case?

You need to create a file in php
Try to save above file with .php extension and execute it
 
Just add this code to a php file and then all you have to do is add the image url like this:
Code:
thephpfile.php?img=http://yourdomain.com/image.jpg
And it will upload it for you

Code:
[COLOR=#000000] [COLOR=#0000BB]<?
[/COLOR][COLOR=#007700]function [/COLOR][COLOR=#0000BB]up2zilla[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$source[/COLOR][COLOR=#007700])
{
    [/COLOR][COLOR=#0000BB]$img_url [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"$source"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//// Variable with image link
    
    [/COLOR][COLOR=#0000BB]$thsize [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]'300'[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//aviable : 250,300,450,500 //[pixels]
    //Dont change
    [/COLOR][COLOR=#0000BB]$url    [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"http://imagezilla.net/inc/uploader.php"[/COLOR][COLOR=#007700];
    [/COLOR][COLOR=#0000BB]$urlek  [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$img_url[/COLOR][COLOR=#007700];
    [/COLOR][COLOR=#0000BB]$post   [/COLOR][COLOR=#007700]= array(
        [/COLOR][COLOR=#DD0000]'url' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]'3'[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'thefiles' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]"$urlek"[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'thumbsize' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]"$thsize"[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'c_thumbsize' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]''[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'tos' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]'agree'[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'nonadult' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]'0'[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'prv' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]'1'[/COLOR][COLOR=#007700],
        [/COLOR][COLOR=#DD0000]'submit' [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#DD0000]'Upload'
    [/COLOR][COLOR=#007700]);
    
    [/COLOR][COLOR=#0000BB]$ch [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]curl_init[/COLOR][COLOR=#007700]();
    [/COLOR][COLOR=#0000BB]curl_setopt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CURLOPT_URL[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]trim[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$url[/COLOR][COLOR=#007700]));
    [/COLOR][COLOR=#0000BB]curl_setopt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CURLOPT_POST[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]);
    [/COLOR][COLOR=#0000BB]curl_setopt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CURLOPT_FOLLOWLOCATION[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]);
    [/COLOR][COLOR=#0000BB]curl_setopt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CURLOPT_POSTFIELDS[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$post[/COLOR][COLOR=#007700]);
    [/COLOR][COLOR=#0000BB]curl_setopt[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CURLOPT_RETURNTRANSFER[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]);
    
    [/COLOR][COLOR=#0000BB]$result [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]curl_exec[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ch[/COLOR][COLOR=#007700]);
    
    
    [/COLOR][COLOR=#0000BB]preg_match_all[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]'|thumbs/(.*).jpg|'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$result[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$img[/COLOR][COLOR=#007700]);
    [/COLOR][COLOR=#FF8000]///Dont change
    
    [/COLOR][COLOR=#0000BB]$okladka [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"http://imagezilla.net/" [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000BB]$img[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#FF8000]// img url from imagezilla.net
    
    
    [/COLOR][COLOR=#007700]echo [/COLOR][COLOR=#DD0000]"<img src='$okladka' />"[/COLOR][COLOR=#007700];
}

if (!empty([/COLOR][COLOR=#0000BB]$_GET[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'img'[/COLOR][COLOR=#007700]])) {
    [/COLOR][COLOR=#0000BB]up2zilla[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$_GET[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'img'[/COLOR][COLOR=#007700]]);
} else {
    echo [/COLOR][COLOR=#DD0000]"Add a image url after your.php?img="[/COLOR][COLOR=#007700];
}
[/COLOR][COLOR=#0000BB]?>[/COLOR] [/COLOR]
 
Hi all!

Sorry for bumping the thread .. but I've checked posted scripts, and none of them are working (or I'm too stupid to make them work, that's a possibility too).

Is there any chance someone could post a working script?

Thank you :)
 
@wd40, I'll code up something for you. Are you looking for regular upload for url upload?
 
Last edited:
hey man.. thanks for your time!

I have written my own bash script that does some automation. I need a script, php or bash one, which uploads image to your host and returns bbcode with 550px thumb. The thing is that I know bash a bit, but I have absolutely zero knowledge with php.

thanks again :)

cheers
 
Well, whichever is easier for you to code. I have no special request there, but of course both options would be nice, the more the merrier :)

If you insist that I choose one, it would be remote upload, I guess :)

cheers
 
Here's a script tested working on linux. I'm not sure about windows but I dont think you should have any problems. One function is for urls and the other function is for files. If you run your own php scripts should be able to just drop the functions in. Let me know if there any problems.

UPDATED: V2
Code:
<?

function imagezilla_url($img_url){
    $thsize = '300'; //valid sizes are 150, 250,300,450,550 pixels
    $img_url = urlencode($img_url);
    $url = "http://imagezilla.net/firefoxremote.php?thumbsize=$thsize&url=$img_url";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, trim($url));
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    preg_match("/(http:\/\/(?:\w+\.){0,1}imagezilla\.net\/thumbs\/.*?)'/i",$result,$tn);
    preg_match("/(http:\/\/(?:\w+\.){0,1}imagezilla\.net\/images\/.*?)'/i",$result,$lp);
    $link_code = '';
    $tn = $tn[1];
    $lp = $lp[1];
    $lp = str_replace('/images/','/show/', $lp);
    $link_code .= "<a href='$lp'><img src='$tn'".'></a>'."\n"; //html
    $link_code .= '[URL='.$lp.'][img]'.$tn.'[/img][/URL]'."\n"; //bbcode
    return $link_code; //first line contains html code, second line contains bb code. Comment out the code you dont want.
} 

function imagezilla_file($img_filename){
    $thsize = '400'; // thumbnail size: must be between 150px and 550px. Default is 400px
    $adult = 1; //defaults to adult images, set it to 0 if you are uploading non-adult images
    $key = "7t7ung19lktujxqddsva7mgtnoi7u1i5";
    $post = array('file'=> "@$img_filename",'apikey' => "$key",'thumbsize' => "$thsize",'adult'=>"$adult");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://imagezilla.net/api.php");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    preg_match('/<thumbnail>(.*?)<\/thumbnail>/i',$result,$tn);
    preg_match('/<largepic>(.*?)<\/largepic>/i',$result,$lp);
    $link_code = '';
    $tn = $tn[1];
    $lp = $lp[1];
    $link_code .= "<a href='$lp'><img src='$tn'".'></a>'."\n"; //html
    $link_code .= '[URL='.$lp.'][img]'.$tn.'[/img][/URL]'."\n"; //bbcode
    return $link_code; //first line contains html code, second line contains bb code. Comment out the code you dont want.
} 
$image = $argv[1];
if (strpos($image, 'http://') === 0) {
    echo imagezilla_url($image);
} else {
    echo imagezilla_file($image);
}
?>
 
Last edited:
You, sir are AWESOME :)

Works like a charm, thanks a lot!

If anyone else needs this script, and (like me) needs forum bbcode with thumbnail, just modify this line

PHP:
$link_code .= '[img]'.$tn.'[/img]'."\n";
into this
PHP:
$link_code .= '[URL='.$lp.'][img]'.$tn.'[/img][/URL]'."\n";
(for people more newbish than me :) )

Although the following line didn't work with remote upload, because remote function returns url with "/images/" instead of "/show/". That will work well when you post it on forum, thumbnail will be loaded, but when you'll click on it, original pic won't be loaded. I've tried changing "/images/" to "/show/", but it didn't work. Normal upload works fine.


One more question though, I've tried modifying the script to get input from bash like some guy posted HERE but of course, I failed :D
Is there a way to do that, so bash command would be something like

Code:
php imagezilla.php my_image.jpg

Of course this isn't essential for me because I've found my way around it, but I would just want to learn a bit more :)

Thanks again for everything!

Cheers
 
I've updated the script. Fixed the large picture url and added some code so that you can use it from the command line. If you give the script a url make it starts with "http://". Everything else that doesn't start with "http://" will be consider a file.

Let me know if there are any bugs. I haven't tested it.
 
Status
Not open for further replies.

About the author

M
Active Member · Joined
Video Bypassing Service Php programming , MYSQL , jQuery
85
Messages
6
Reactions
8
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom