Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!
vintage erotica forum vintage erotica forum vintage erotica forum
vintage erotica forum
Home
Go Back   Vintage Erotica Forums > Information & Help Forum > Help Section > Image Hosts
Best Porn Sites Live Sex Register FAQ Members List Calendar Mark Forums Read

Notices

Reply
 
Thread Tools Display Modes
Old June 17th, 2017, 06:34 AM   #1
sagjob
Senior Member
 
Join Date: Aug 2011
Posts: 333
Thanks: 1,098
Thanked 8,541 Times in 339 Posts
sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+
Default pixhost.org BASH upload script

If you are familiar with BASH scripts, thought I'd post this in case someone wanted to modify it for their needs.

READ THE WARNING IN THE SCRIPT COMMENTS OR YOU'LL SCREW THIS UP.
- BBCODE won't let me post it as-is.


Code:
#!/bin/bash

#Fix sequence for missing images (404 not found)
#Rename 0001, 0002, 0003...
#Delete this if you want to keep filenames
a=1
for i in *.[Jj][Pp][Gg]; do
  new=$(printf "%04d.jpg" "$a") #04 pad to length of 4
  mv -i -- "$i" "$new"
  let a=a+1
done

#Find all JPG files in current folder
files=($(find -E . -type f -regex "^.*jpg"))
#Clear the Forum URL txt file if it exists.
> post.txt
#Process each JPG Found
for item in ${files[*]}
do
  printf "   %s\n" $item | sed 's/\ \ \ .\///g'
  output=$(curl -X POST --include "https://api.pixhost.to/images"  -H 'Content-Type: multipart/form-data; charset=utf-8' -H 'Accept: application/json' -F "img=@$item" -F 'content_type=0' -F 'max_th_size=180')
  fullImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/\".*//g')
  thumbImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/^.*th_url//g' | sed 's/"}//g')
# WARNING: CHANGE below { to [ and } to ]...bbcode makes this a URL so it won't post right on forum.
  echo -n "{url="$fullImage"][img]"$thumbImage"[/img][/url} " >> post.txt
done

#Put into OSX Clipboard
cat post.txt | sort | pbcopy

#Send OSX Notification
osascript -e 'display notification "Copied to Clipboard" with title "Upload Complete"'

#Delete all JPGs in folder to clear for next batch.
rm *.jpg
I run this on OSX Sierra. It is messy, but functional for my needs. Some command may not be native to OSX. May require HomeBrew https://brew.sh/

Feel free to tweak and repost a better version that is more adaptable to all. Just sharing in case it helps someone get started on their own script.

If you don't know what you're doing—Don't. You've been warned.

Here it is in action.

https://www.youtube.com/watch?v=T4-anPkVvfg
sagjob is offline   Reply With Quote
The Following 7 Users Say Thank You to sagjob For This Useful Post:


Old June 17th, 2017, 09:55 AM   #2
retroanalyst
in memoriam Max
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 3,579
Thanks: 121,727
Thanked 47,378 Times in 3,330 Posts
retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+
Default

Quote:
Originally Posted by sagjob View Post
If you are familiar with BASH scripts, thought I'd post this in case someone wanted to modify it for their needs.

READ THE WARNING IN THE SCRIPT COMMENTS OR YOU'LL SCREW THIS UP.
- BBCODE won't let me post it as-is.
Note that there is a noparse tag to disable the interpretation of BBcode. I have attempted this below.

Code:
#!/bin/bash

#Fix sequence for missing images (404 not found)
#Rename 0001, 0002, 0003...
#Delete this if you want to keep filenames
a=1
for i in *.[Jj][Pp][Gg]; do
  new=$(printf "%04d.jpg" "$a") #04 pad to length of 4
  mv -i -- "$i" "$new"
  let a=a+1
done

#Find all JPG files in current folder
files=($(find -E . -type f -regex "^.*jpg"))
#Clear the Forum URL txt file if it exists.
> post.txt
#Process each JPG Found
for item in ${files[*]}
do
  printf "   %s\n" $item | sed 's/\ \ \ .\///g'
  output=$(curl -X POST --include "https://api.pixhost.to/images"  -H 'Content-Type: multipart/form-data; charset=utf-8' -H 'Accept: application/json' -F "img=@$item" -F 'content_type=0' -F 'max_th_size=180')
  fullImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/\".*//g')
  thumbImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/^.*th_url//g' | sed 's/"}//g')
  echo -n "[url="$fullImage"][img]"$thumbImage"[/img][/url] " >> post.txt
done

#Put into OSX Clipboard
cat post.txt | sort | pbcopy

#Send OSX Notification
osascript -e 'display notification "Copied to Clipboard" with title "Upload Complete"'

#Delete all JPGs in folder to clear for next batch.
rm *.jpg
Quote:
I run this on OSX Sierra. It is messy, but functional for my needs. Some command may not be native to OSX. May require HomeBrew https://brew.sh/

Feel free to tweak and repost a better version that is more adaptable to all. Just sharing in case it helps someone get started on their own script.

If you don't know what you're doing—Don't. You've been warned.

Here it is in action.

https://www.youtube.com/watch?v=T4-anPkVvfg
Thanks. Except for the clipboard/notification commands, the script should also run on Linux and on other Unices.
retroanalyst is offline   Reply With Quote
The Following 8 Users Say Thank You to retroanalyst For This Useful Post:
Old June 17th, 2017, 02:25 PM   #3
sagjob
Senior Member
 
Join Date: Aug 2011
Posts: 333
Thanks: 1,098
Thanked 8,541 Times in 339 Posts
sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+
Default

Thanks. That's what I needed.
sagjob is offline   Reply With Quote
The Following 6 Users Say Thank You to sagjob For This Useful Post:
Old June 17th, 2017, 06:03 PM   #4
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Tulsa
Posts: 23,168
Thanks: 609
Thanked 274,955 Times in 23,048 Posts
herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+
Default

It appears that you're not making galleries..?

Just wondering. I was going to work on redoing my upload scripts after I had downloaded and sorted my images from imagebam. I had used PHP to do my previous upload script. I would just point it to a folder and it would upload each image in that folder ascending alphabetically.

Script would take 2 arguements: name of gallery, folder path

I was planning to retrofit some pieces into a new script to upload for pixhost that way you could note your gallery links and use them.

Code:
<?php
$ID=$argv[1];
$gal_ID=NULL;
function gallery($gallery)
{
global $gal_ID;
// required parameters for the OAuth-authentication
// replace all parameters!
$API_key = "ABCD1234";
$API_secret = "ABCD1234";
$on1=rand(10000000,99999999);
$oauth_nonce = "$on1";
$oauth_token = "ABCD1234";
$oauth_token_secret = "ABCD1234";
$oauth_timestamp = time();
$oauth_signature_method = "MD5";
#$oauth_consumer_key = "1RSF4O2X";
// build the signature string
$oauth_signature_string = "";
$oauth_signature_string .= $API_key;
$oauth_signature_string .= $API_secret;
$oauth_signature_string .= $oauth_timestamp;
$oauth_signature_string .= $oauth_nonce;
$oauth_signature_string .= $oauth_token;
$oauth_signature_string .= $oauth_token_secret;


// calculate the MD5-checksum of the signature string
$oauth_signature = md5($oauth_signature_string);

// populate an array with parameters
$gal_vars   = array(
        // parameters required by OAuth
        "oauth_consumer_key" => $API_key,
        "oauth_signature_method" => $oauth_signature_method,
        "oauth_signature" => $oauth_signature,
        "oauth_timestamp" => $oauth_timestamp,
        "oauth_nonce" => $oauth_nonce,
        "oauth_token" => $oauth_token,

        // optional parameters
        "response_format" => "JSON",
        "title" => "$gallery",
);

// initialize curl and set parameters
$gal_curl    = curl_init();
curl_setopt($gal_curl, CURLOPT_URL, 'http://www.imagebam.com/sys/API/resource/create_gallery');
curl_setopt($gal_curl, CURLOPT_TIMEOUT, 30);
curl_setopt($gal_curl, CURLOPT_POST, 1);
curl_setopt($gal_curl, CURLOPT_POSTFIELDS, $gal_vars);
curl_setopt($gal_curl, CURLOPT_RETURNTRANSFER, true);

// execute, get information and close connection
$gal_response = curl_exec($gal_curl);
$info = curl_getinfo($gal_curl);
curl_close ($gal_curl);


// check if the http-code is 200
if($info['http_code'] != 200) {
    exit("OAuth error: ".$gal_response);
}

// decode the json-encoded response
$gal_response_array = json_decode($gal_response, true);

// print nicely
print_r($gal_response_array);
//grab new gallery ID
$gal_ID=$gal_response_array["rsp"]["gallery"]["GID"];
}

function upload($img)
{
global $ID;
//global $gal_ID;
// required parameters for the OAuth-authentication
// replace all parameters!
$API_key = "ABCD1234";
$API_secret = "ABCD1234";
$on1=rand(10000000,99999999);
$oauth_nonce = "$on1";
$oauth_token = "ABCD1234";
$oauth_token_secret = "ABCD1234";
$oauth_timestamp = time();
$oauth_signature_method = "MD5";

// build the signature string
$oauth_signature_string = "";
$oauth_signature_string .= $API_key;
$oauth_signature_string .= $API_secret;
$oauth_signature_string .= $oauth_timestamp;
$oauth_signature_string .= $oauth_nonce;
$oauth_signature_string .= $oauth_token;
$oauth_signature_string .= $oauth_token_secret;

// calculate the MD5-checksum of the signature string
$oauth_signature = md5($oauth_signature_string);

// populate an array with parameters
$pvars   = array(
        // parameters required by OAuth
        "oauth_consumer_key" => $API_key,
        "oauth_signature_method" => $oauth_signature_method,
        "oauth_signature" => $oauth_signature,
        "oauth_timestamp" => $oauth_timestamp,
        "oauth_nonce" => $oauth_nonce,
        "oauth_token" => $oauth_token,

        // optional parameters
        "content_type" => "adult",
        "thumb_size" => "180x180",
        "image" => "@$img", // ATTENTION - note the @ infront of the filename!
        "gallery_id" => "$ID"
);
//print_r($pvars);
// initialize curl and set parameters
$curl    = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.imagebam.com/sys/API/resource/upload_image');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

// execute, get information and close connection
$response = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close ($curl);

// decode the json-encoded response
$response_array = json_decode($response);

// print nicely
print_r($response_array);
print_r($info);
}

//gallery($argv[1]);
$dir=$argv[2];

foreach(scandir("$dir") as $entry)
{
 if ($entry != "." && $entry != ".." && $entry != "upload_folder.php")
 {
  upload("$dir$entry");
 }
}

?>
From pixhosts api docs - https://pixhost.to/api/index.html#galleries

Code:
{   "gallery_name": "Test gallery",   "gallery_hash": "8NtKF",   "gallery_url": "http:\/\/pixhost.to\/galleries\/8NtKF",   "gallery_upload_hash": "yKtOl8NbHMYJ8yWj8Mh90sIlfXC7PXT6RHW8Xua7" }
Another note, I chose to use PHP for these operations because it can natively turn json into objects.

You get the response back from the API in json format, and using json_decode function in PHP you could get rid of all of the sed calls you make to pull out the image link. With php it would come back from the curl call as a reponse ($curl_response)

Then just json decode and you would have an object you could call

Code:
$resp=json_decode($response);
$imglink=$resp->show_url;
__________________
My posts are scripted, sorry if the preview images aren't great, but the whole gallery is in the link
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


If I post any duplicates, please PM me and I will remove them

Last edited by herkalurk; June 17th, 2017 at 06:11 PM..
herkalurk is offline   Reply With Quote
The Following 7 Users Say Thank You to herkalurk For This Useful Post:
Old June 17th, 2017, 11:01 PM   #5
sagjob
Senior Member
 
Join Date: Aug 2011
Posts: 333
Thanks: 1,098
Thanked 8,541 Times in 339 Posts
sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+
Default

Yeah, I didn't do galleries. Still not very good at PHP (or bash scripting for that matter). Thanks for sharing your method!
sagjob is offline   Reply With Quote
The Following 5 Users Say Thank You to sagjob For This Useful Post:
Old June 17th, 2017, 11:43 PM   #6
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Tulsa
Posts: 23,168
Thanks: 609
Thanked 274,955 Times in 23,048 Posts
herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+
Default

Quote:
Originally Posted by sagjob View Post
Yeah, I didn't do galleries. Still not very good at PHP (or bash scripting for that matter). Thanks for sharing your method!
To be fair, that was for imagebam, I have yet to write anything for pixhost, still downloading everything I can. My next step is to verify I got as much and probably retry all of the downloads.

Then I need to figure out my upload method, then figure out editing my posts with the new image links. One thing I will mention to others for the future is to use galleries, but to also use unique names if you can. The majority of my galleries are uniquely named, so my plan is to script a way to edit my posts and use the post title to find the gallery, then insert the new image links in place of the old. I have yet to do an index of the post ID and title of each of my posts as of yet, but I will. It will take a while since I have 13000 posts...
__________________
My posts are scripted, sorry if the preview images aren't great, but the whole gallery is in the link
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


If I post any duplicates, please PM me and I will remove them
herkalurk is offline   Reply With Quote
The Following 4 Users Say Thank You to herkalurk For This Useful Post:
Old June 17th, 2017, 11:47 PM   #7
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Tulsa
Posts: 23,168
Thanks: 609
Thanked 274,955 Times in 23,048 Posts
herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+
Default

Quote:
Originally Posted by sagjob View Post
Yeah, I didn't do galleries. Still not very good at PHP (or bash scripting for that matter). Thanks for sharing your method!
As for scripting experience you just have to do it. If it's a task that you would have to do at least 20 times, script it. I learned bash because of my first IT job (linux systems administrator), php cause I wanted to (helped that I worked for a web development shop too), and now I have to use javascript for my job with vmware products. The core is the same, it's how the functions are executed.
__________________
My posts are scripted, sorry if the preview images aren't great, but the whole gallery is in the link
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


If I post any duplicates, please PM me and I will remove them
herkalurk is offline   Reply With Quote
The Following 3 Users Say Thank You to herkalurk For This Useful Post:
Old June 18th, 2017, 12:37 AM   #8
sagjob
Senior Member
 
Join Date: Aug 2011
Posts: 333
Thanks: 1,098
Thanked 8,541 Times in 339 Posts
sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+sagjob 25000+
Default

I learned bash scripting because I do a ton of file manipulation and lots of repetitive processes in OSX/Linux. Most of my stuff is quick and dirty—sort life stuff. Never been disciplined enough to get down and write beautiful code.
sagjob is offline   Reply With Quote
The Following 4 Users Say Thank You to sagjob For This Useful Post:
Old June 22nd, 2017, 09:57 PM   #9
retroanalyst
in memoriam Max
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 3,579
Thanks: 121,727
Thanked 47,378 Times in 3,330 Posts
retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+retroanalyst 175000+
Default pixhostuploader

I have just stumbled upon a pixhost uploader written in Python. Did not try it yet, but it might be a reasonable alternative to home-grown bash or php scripts.

EDIT: After a cursory look at the code I'm positive there is no gallery support whatsoever, which is bad.

Last edited by retroanalyst; June 22nd, 2017 at 10:26 PM..
retroanalyst is offline   Reply With Quote
The Following 6 Users Say Thank You to retroanalyst For This Useful Post:
Old June 24th, 2017, 02:47 AM   #10
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Tulsa
Posts: 23,168
Thanks: 609
Thanked 274,955 Times in 23,048 Posts
herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+herkalurk 1000000+
Default

Quote:
Originally Posted by retroanalyst View Post
I have just stumbled upon a pixhost uploader written in Python. Did not try it yet, but it might be a reasonable alternative to home-grown bash or php scripts.

EDIT: After a cursory look at the code I'm positive there is no gallery support whatsoever, which is bad.
I was always going to home grow mine though. I need to document the galleries and images into a easily query-able database. Already built the database structure, just need to make the script and start uploading images.

For me galleries are a huge part of my upload process. I have logic that determines if the number of total images is over 125 (post limit of thumbnails) then I should only select 4 image thumbnails and the gallery link instead. One thing that surprises me about pixhost is that the gallery ID is only 5 characters. It still provides 916132832 possible combinations with upper, lower, and number characters, so it's probably enough. Imagebam used 32 characters for their gallery hash.
__________________
My posts are scripted, sorry if the preview images aren't great, but the whole gallery is in the link
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


If I post any duplicates, please PM me and I will remove them
herkalurk is offline   Reply With Quote
The Following 4 Users Say Thank You to herkalurk For This Useful Post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump




All times are GMT. The time now is 11:25 AM.






vBulletin Optimisation provided by vB Optimise v2.6.1 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.