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

Go Back   Vintage Erotica Forums > Information & Help Forum > Help Section > Imagebam/Imgbox are no longer shutting down

Follow Vintage Erotica Forum on Twitter
Best Porn Sites Meet Our Girls Register FAQ Members List Calendar Mark Forums Read

Notices
Imagebam/Imgbox are no longer shutting down The day has been saved, the sites are not shutting, more info soon.


Reply
 
Thread Tools Display Modes
Old 06-24-2017, 05:57 AM   #11
retroanalyst
in memoriam erdnuss
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 2,119
Thanks: 69,903
Thanked 26,800 Times in 1,929 Posts
retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+
Default

Quote:
Originally Posted by herkalurk View Post
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.
Be aware that there seems to be an undocumented limit of ca. 100 MiB for what you can upload at a time.

Quote:
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.
It's not totally inconceivable that Pixhost will hit 900 million galleries one day, but I guess it will be easy for them to increase the length of the gallery ID if needed.
__________________
Indifference will certainly be the downfall of mankind, but who cares?
retroanalyst is offline   Reply With Quote
The Following User Says Thank You to retroanalyst For This Useful Post:
Old 06-24-2017, 03:17 PM   #12
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Los Angeles
Posts: 17,363
Thanks: 101
Thanked 142,821 Times in 17,220 Posts
herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+
Default

Quote:
Originally Posted by retroanalyst View Post
Be aware that there seems to be an undocumented limit of ca. 100 MiB for what you can upload at a time.

It's not totally inconceivable that Pixhost will hit 900 million galleries one day, but I guess it will be easy for them to increase the length of the gallery ID if needed.
In regards to the limit - it looks like the context is in relation to a zip upload? Not per file, which is how the API operates.

Also, I don't like the fact that they could increase the size of the gallery hash from 5 - whatever number of characters. It means I have to modify my code to accommodate later because they didn't just use a larger number now.
__________________
My posts are scripted, sorry if the preview images suck, 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 User Says Thank You to herkalurk For This Useful Post:
Old 06-24-2017, 03:48 PM   #13
retroanalyst
in memoriam erdnuss
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 2,119
Thanks: 69,903
Thanked 26,800 Times in 1,929 Posts
retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+
Default

Quote:
Originally Posted by herkalurk View Post
In regards to the limit - it looks like the context is in relation to a zip upload?
It's through a file selection dialog on the "Classic Upload" page, they use this input box for it.

Code:
<input type="file" name="img[]" accept="image/gif,image/png,image/jpeg" multiple>
Probably won't affect uploads through the API since those will loop over the files.

Quote:
Also, I don't like the fact that they could increase the size of the gallery hash from 5 - whatever number of characters. It means I have to modify my code to accommodate later because they didn't just use a larger number now.
I don't follow. The gallery hash is a string, why would you care how long it is?
__________________
Indifference will certainly be the downfall of mankind, but who cares?

Last edited by retroanalyst; 06-26-2017 at 03:34 PM.. Reason: fix quote
retroanalyst is offline   Reply With Quote
The Following User Says Thank You to retroanalyst For This Useful Post:
Old 06-24-2017, 07:32 PM   #14
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Los Angeles
Posts: 17,363
Thanks: 101
Thanked 142,821 Times in 17,220 Posts
herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+
Default

Quote:
Originally Posted by retroanalyst View Post
I don't follow. The gallery hash is a string, why would you care how long it is?
When you create a standard sql type database (mysql,mssql,oracle), you set structure around your data. So in the field for the gallery hash, I say that this field should be 5 characters long and a type of standard characters (letters numbers, etc). I did the same thing for my imagebam database. Since their gallery hash is 32 characters long that is the length allowed in that field in the database I made for that upload tool.

This gets into protecting your inputs, and data validation. If you were to have a field of only numbers you would limit it to only integer inputs so no one could accidentally put letters there.

I do IT for a living....
__________________
My posts are scripted, sorry if the preview images suck, 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 2 Users Say Thank You to herkalurk For This Useful Post:
Old 06-26-2017, 03:46 PM   #15
retroanalyst
in memoriam erdnuss
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 2,119
Thanks: 69,903
Thanked 26,800 Times in 1,929 Posts
retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+
Default

Quote:
Originally Posted by herkalurk View Post
When you create a standard sql type database (mysql,mssql,oracle), you set structure around your data. So in the field for the gallery hash, I say that this field should be 5 characters long and a type of standard characters (letters numbers, etc). I did the same thing for my imagebam database. Since their gallery hash is 32 characters long that is the length allowed in that field in the database I made for that upload tool.

This gets into protecting your inputs, and data validation. If you were to have a field of only numbers you would limit it to only integer inputs so no one could accidentally put letters there.
That's all nice, but the Pixhost API guarantees only that the gallery hash is a string, not what length it has. Thus, storing it in a fixed-length datatype record is asking for trouble.

While I was looking closer at the API, I wondered why there are two different hashes in the first place and why they don't use a single long hash. Must be because they want to allow sharing galleries via Twitter, so the URL had better be short.
__________________
Indifference will certainly be the downfall of mankind, but who cares?
retroanalyst is offline   Reply With Quote
The Following User Says Thank You to retroanalyst For This Useful Post:
Old 06-26-2017, 04:01 PM   #16
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Los Angeles
Posts: 17,363
Thanks: 101
Thanked 142,821 Times in 17,220 Posts
herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+
Default

Quote:
Originally Posted by retroanalyst View Post
That's all nice, but the Pixhost API guarantees only that the gallery hash is a string, not what length it has. Thus, storing it in a fixed-length datatype record is asking for trouble.

While I was looking closer at the API, I wondered why there are two different hashes in the first place and why they don't use a single long hash. Must be because they want to allow sharing galleries via Twitter, so the URL had better be short.
Based on what I can tell they only allow you to add images to a gallery for 24 hours, or until the gallery has been 'finalized'. Not sure why they need 2 hash strings for it, considering the upload hash is much larger.
__________________
My posts are scripted, sorry if the preview images suck, 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 User Says Thank You to herkalurk For This Useful Post:
Old 06-26-2017, 04:09 PM   #17
retroanalyst
in memoriam erdnuss
 
retroanalyst's Avatar
 
Join Date: Jun 2009
Location: Germany
Posts: 2,119
Thanks: 69,903
Thanked 26,800 Times in 1,929 Posts
retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+retroanalyst 100000+
Default Gallery upload script

I was unhappy with the lack of gallery support in existing pixhost upload tools, so I decided to sit down and write my own little shell script. All it currently does is take a folder name as argument (and a gallery name, optionally) and upload all images in that folder to a gallery on pixhost. At the end, it prints the gallery URL which you had better save lest you never find your uploaded pictures.

Not really sophisticated, but it's less than 50 lines of code. Professionals like herkalurk might scoff at it, but for us laymen it's a start.

Code:
#!/bin/sh
# Script to upload all images in a directory to pixhost,
# creating a gallery there.
# Parameters: directory containing the files to upload (mandatory),
# gallery name (recommended but optional, use directory name by default)

set -e
set -u

DIR=$1
[ -n "$DIR" ] || { echo "$0: Need a directory argument" >&2; exit 1; }
[ -d "$DIR" ] || { echo "$0: $1 is not a directory" >&2; exit 1; }

GALLERY_NAME=${2:-$(basename "${DIR}")}

# Initialize gallery and extract returned values
PARAMS=$(curl -s -S -X POST --include "https://api.pixhost.to/galleries" \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
  -H 'Accept: application/json' \
  -d "gallery_name=${GALLERY_NAME}" | tail -n1 | tr -d '"')
HASH=$(echo $PARAMS | sed 's/.*gallery_hash://' | sed 's/[,}].*//')
URL=$(echo $PARAMS | sed 's/.*gallery_url://' | sed 's/[,}].*//')
UPLOAD_HASH=$(echo $PARAMS | sed 's/.*gallery_upload_hash://' | sed 's/[,}].*//')

# Upload images, silently skipping apparent non-image files for now.
for file in "${DIR}"/* ; do
    case ${file} in
	*jpg|*.JPG|*.jpeg|*.gif|*.png)
	    curl -s -S -X POST --include "https://api.pixhost.to/images" \
		 -H 'Content-Type: multipart/form-data; charset=utf-8' \
		 -H 'Accept: application/json' \
		 -F "img=@${file}" \
		 -F 'content_type=1' \
		 -F 'max_th_size=180' \
		 -F "gallery_hash=$HASH" \
		 -F "gallery_upload_hash=$UPLOAD_HASH" > /dev/null
	    ;;
    esac
done

# Finalize gallery
curl -s -S -X POST --include "https://api.pixhost.to/galleries/$HASH/finalize" \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
  -H 'Accept: application/json' \
  -d "gallery_upload_hash=$UPLOAD_HASH" > /dev/null

echo "Gallery \"$GALLERY_NAME\" available at $URL."
Windows users will have to install a few basic tools (bash, sed, coreutils) and of course curl before they can use the script.
retroanalyst is offline   Reply With Quote
The Following 3 Users Say Thank You to retroanalyst For This Useful Post:
Old 10-29-2017, 05:43 AM   #18
herkalurk
Vintage Member
 
herkalurk's Avatar
 
Join Date: Apr 2011
Location: Los Angeles
Posts: 17,363
Thanks: 101
Thanked 142,821 Times in 17,220 Posts
herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+herkalurk 500000+
Default

I actually wrote the gallery upload in php. I save the information to a mysql database so I know all of my galleries for later user. I tend to upload many at a time, so this makes it easier to recall later. This requires the unirest extra code as displayed in the tutorial at pixhosts's api.

The script works by passing 2 arguments: first is the name of the gallery you're creating, second is the folder where the images are located.

Code:
<?php

require_once '/home/user/unirest-php/src/Unirest.php';

$db=mysqli_connect('localhost','pix','pix','pix');

function create_gal($gal_name) {
        $response = Unirest\Request::post("https://api.pixhost.to/galleries",
                [
                        "Content-Type" => "application/x-www-form-urlencoded; charset=utf-8",
                        "Accept" => "application/json"
                ],
                Unirest\Request\Body::form([
                        "gallery_name" => $gal_name
                ])
        );
        print_r($response);
        return $response;
}

function finalize() {
        global $gal_json;
        $response = Unirest\Request::post("https://api.pixhost.to/galleries/{$gal_json->body->gallery_hash}/finalize",
                [
                        "Content-Type" => "application/x-www-form-urlencoded; charset=utf-8",
                        "Accept" => "application/json"
                ],
                Unirest\Request\Body::form([
                        "gallery_upload_hash" => "{$gal_json->body->gallery_upload_hash}"
                ])
        );
}

function upload($img) {
        global $gal_json;
        $response = Unirest\Request::post("https://api.pixhost.to/images",
                [
                        "Content-Type" => "multipart/form-data; charset=utf-8",
                        "Accept" => "application/json"
                ],
                [
                        "img" => Unirest\Request\Body::file($img),
                        "content_type" => "1",
                        "max_th_size" => "180",
                        "gallery_hash" => $gal_json->body->gallery_hash,
                        "gallery_upload_hash" => $gal_json->body->gallery_upload_hash
                ]
        );
        print_r($response);
        return $response;
}

//$gal_json=json_decode(create_gal($argv[1]));
$gal_json=create_gal($argv[1]);

mysqli_query($db,"insert into galleries (`gallery_name`,`gallery_hash`,`gallery_upload_hash`,`gallery_url`) values ('{$gal_json->body->gallery_name}','{$gal_json->body->gallery_hash}','{$gal_json->body->gallery_upload_hash}','{$gal_json->body->gallery_url}');");

foreach(scandir($argv[2]) as $entry) {
        if ($entry != "." && $entry != ".." && $entry != "upload_folder.php") {
                $img_json=upload("{$argv[2]}{$entry}");
                mysqli_query($db,"insert into images (`gallery_hash`,`name`,`show_url`,`th_url`) values ('{$gal_json->body->gallery_hash}','{$img_json->body->name}','{$img_json->body->show_url}','{$img_json->body->th_url}');");
        }
}

finalize();

mysqli_close($db);

?>
If anyone cares the mysql table structure is below

Code:
-- phpMyAdmin SQL Dump
-- version 4.4.15.10
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 29, 2017 at 01:43 AM
-- Server version: 5.5.56-MariaDB
-- PHP Version: 5.4.16

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `pix`
--

-- --------------------------------------------------------

--
-- Table structure for table `galleries`
--

CREATE TABLE IF NOT EXISTS `galleries` (
  `ID` int(8) NOT NULL,
  `gallery_name` varchar(100) NOT NULL,
  `gallery_hash` varchar(5) NOT NULL,
  `gallery_upload_hash` varchar(40) NOT NULL,
  `gallery_url` varchar(60) NOT NULL,
  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `images`
--

CREATE TABLE IF NOT EXISTS `images` (
  `ID` int(8) NOT NULL,
  `gallery_hash` varchar(5) NOT NULL,
  `name` varchar(150) NOT NULL,
  `show_url` varchar(150) NOT NULL,
  `th_url` varchar(150) NOT NULL,
  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `galleries`
--
ALTER TABLE `galleries`
  ADD PRIMARY KEY (`ID`) USING BTREE,
  ADD UNIQUE KEY `gallery_hash` (`gallery_hash`) USING BTREE,
  ADD KEY `addTime` (`addTime`);

--
-- Indexes for table `images`
--
ALTER TABLE `images`
  ADD PRIMARY KEY (`ID`),
  ADD KEY `gallery_hash` (`gallery_hash`),
  ADD KEY `addTime` (`addTime`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `galleries`
--
ALTER TABLE `galleries`
  MODIFY `ID` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `images`
--
ALTER TABLE `images`
  MODIFY `ID` int(8) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
__________________
My posts are scripted, sorry if the preview images suck, 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 2 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 07:30 AM.






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