think tank forum

technology » larz's photo album software

lucas's avatar
16 years ago
link
lucas
i ❤ demo
k, so here's my plan:

1. code an aws s3 php rest class in php
2. code the back-end using mysql (objections?)
3. code the front-end uses xhtml1 and css2

my scripts will not upload photos. you'll have to use a command-line utility to get them up on s3. you'll upload them in high-res jpg. this will be great, because it'll be easy to create a ruby or python cli script to grab all of the pictures off your camera (assuming they aren't RAW) and PUT them to s3.

then you visit the admin page, and it shows you what you have newly uploaded. you can caption the photos, date them, sort them, et cetera.

either the uploading cli script with create thumbnails and a web-viewable size, or the php script will GET the photo from s3, make multiple sizes, and PUT them all on s3 again.

how does that all sound?
nestor's avatar
16 years ago
link
nestor
nestor
minimalist. i like it.

i don't know anything about the programming stuff though.
bluet's avatar
16 years ago
link
bluet
do you have to pay for s3?
lucas's avatar
16 years ago
link
lucas
i ❤ demo
yeah.
dannyp's avatar
16 years ago
link
dannyp
dʎuuɐp
exif data editing page?

http://www.sentex.net/~mwandel/jhead/
jhead is invoked upon edits on a php page?
bluet's avatar
16 years ago
link
bluet
i was gonna use jhead for my own photo software
DaGr8Gatzby's avatar
16 years ago
link
DaGr8Gatzby
Drunk by Myself
yea I don't like MySQL
dannyp's avatar
16 years ago
link
dannyp
dʎuuɐp
postgresql
or mysql

I'm ok with both

dp
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i'm still trying to decide how i want uploads to s3 to work. otherwise, s3 looks like it will be very easy to use.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
for now, i'm going to require that the photos are resized on the user's machine and each size uploaded to s3 manually. (this is very quick to do in a batch resize with ImageMagick or Irfanview and s3 tools.)

then the photo management page will find the new files and let you assign properties to them. :D
bluet's avatar
16 years ago
link
bluet
i have some code for resizing with convert. i could give it to you if you want
lucas's avatar
16 years ago
link
lucas
i ❤ demo
it's almost done. the code might be a little dirty, but it's working pretty awesome so far.
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
screenshots!
Carpetsmoker's avatar
16 years ago
link
Carpetsmoker
Martin
I made this some time ago, just for personal purposes:
http://rwxrwxrwx.net/images/Image-resize.php

You can view the source here:
http://rwxrwxrwx.net/images/Image-resize.php.txt
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
just for fun, here's an image upload function that I wrote for my blog software:

http://thehomerow.net/~brain/uploadImage.txt

it takes $filename, $picture_tmp_name, $picture_comment, $post_id, and $size as arguments.

$filename is essentially $_FILES['picture']['name'], or the filename of the uploaded picture.

$picture_tmp_name is $_FILES['picture']['tmp_name'].

$picture_comment is $_POST['comment'], and is set to the filename if it's empty (I think).

$post_id is used to relate the picture of a blog post.

and $size is the number of pixels you want the largest dimension of the image to be. so if you set it to 1024 and you're resizing a 1600x1200 image, it will resize it to 1024x768.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
it sucks that exif_read_data() can only operate on a local file. so i have to read a file from s3, write it somewhere on the disk, and then i can get some exif data for the image.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
look at this dumb script..

print meta data retrieved from an image in aws s3

<?php

/*********************************
 * GET MYSQL AND AWS CREDENTIALS *
 *********************************/
require_once "../../../inc_credentials.php";

/*********************************
 * GET GLOBAL VARS AND FUNCTIONS *
 *********************************/
require_once "../global.php";

$test_image = "c/000000001.jpg";
$url = "http://$s3_bucket.s3.amazonaws.com/$s3_path/$test_image";
$tmp_file = "/tmp/lucas_photo_shuffle.jpg";

if (!$file_str = file_get_contents($url)) {
    die("could not get file from s3.");
};

if (!file_put_contents($tmp_file, $file_str)) {
    die("could not put file into $tmp_file.");
};

if (!$exif = exif_read_data($tmp_file, 0, TRUE)) {
    die("could not read exif data from image.");
}

if (!unlink($tmp_file)) {
    die("could not unlink $tmp_file.");
};

foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: $val<br />\n";
    };
};

?>
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i want to print some meta data on the photo's page. i'm storing the data in the mysql table so it doesn't have to be read from s3 on-demand.

i'm planning on storing:
IFD0.Model
EXIF.ExposureTime
EXIF.FNumber
EXIF.ISOSpeedRatings
EXIF.Flash
EXIF.FocalLength
EXIF.DateTimeOriginal

should i grab anything else to show visitors?

here's how it's formatted right now (maybe it should be friendlier):

camera: Canon PowerShot SD750
exposure time: 1/6
f-number: 28/10
iso speed ratings: 400
flash: did not fire
focal length: 5800/1000
original date and time: 2008:05:17 21:53:38

bluet's avatar
16 years ago
link
bluet
yeah, grab everything
lucas's avatar
16 years ago
link
lucas
i ❤ demo
:/

i don't want a huge page of garbage like this, though: http://www.wingedleopard.net/lucas/photos/?vi … p;showexif
bluet's avatar
16 years ago
link
bluet
you don't have to show everything, but keep it in the database so you can search with it
lucas's avatar
16 years ago
link
lucas
i ❤ demo
so should i give each of those keys its own field in the database table? or be ghetto and dump it all into one field serialized?
dannyp's avatar
16 years ago
link
dannyp
dʎuuɐp
no dirty serials
lucas's avatar
16 years ago
link
lucas
i ❤ demo
so the table photo_image is gonna have like 200 fields?
bluet's avatar
16 years ago
link
bluet
can't you have a separate table for exif?
lucas's avatar
16 years ago
link
lucas
i ❤ demo
then it's not normal form. (http://en.wikipedia.org/wiki/Database_normalization)
bluet's avatar
16 years ago
link
bluet
you don't *have* to have a fully normalized model
bluet's avatar
16 years ago
link
bluet
but if you want that, yeah, 200 fields
lucas's avatar
16 years ago
r1, link
lucas
i ❤ demo
this post has been archived.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
haha :(

i think i'll stick with seven fields for my own purposes
bluet's avatar
16 years ago
link
bluet
make it easy to use 200 fields for someone like me though please :)
bluet's avatar
16 years ago
link
bluet
actually i think i'll just port it to use ruby and local files. when it's reached some stability
lucas's avatar
16 years ago
link
lucas
i ❤ demo
you might as well make your own from scratch. the whole point here is php+mysql+s3 from the ground up.

i would like your help with ui design once i get the coding done, though. so maybe you'd find some of that useful.
bluet's avatar
16 years ago
link
bluet
sure. i'd still use a database though, but probably sqlite
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i need a name for my project...
nestor's avatar
16 years ago
link
nestor
nestor
something greek

hyperion
lucas's avatar
16 years ago
link
lucas
i ❤ demo
too bad there's not a muse of art

maybe sappho...
nestor's avatar
16 years ago
link
nestor
nestor
sure!

project sappho
lucas's avatar
16 years ago
link
lucas
i ❤ demo
or maybe hippocrene
lucas's avatar
16 years ago
link
lucas
i ❤ demo
back in development!

i can has squared thumbnails?

http://www.wingedleopard.net/lucas/wlwp/set/3/
lucas's avatar
16 years ago
link
lucas
i ❤ demo
http://code.google.com/p/sappho/

we're on the run!
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
looks awesome!
lucas's avatar
16 years ago
link
lucas
i ❤ demo
thanks!
lucas's avatar
16 years ago
link
lucas
i ❤ demo
a handful of things to do:
http://code.google.com/p/sappho/issues/list
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
in global.php you have mysql user and pass set to user:pass. are these the credentials you have set up on your development box for the mysql server or do you somehow modify those when you're working with the code and they're only user:pass on the svn'ed copy? I had issues with this before.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
yeah, you have to setup a mysql server with a user that has full access to a database. then you set those variables accordingly.
nestor's avatar
16 years ago
link
nestor
nestor
looks good.
bluet's avatar
16 years ago
link
bluet
it needs previous and next buttons
nestor's avatar
16 years ago
link
nestor
nestor
there is a next link
it just don't work
lucas's avatar
16 years ago
link
lucas
i ❤ demo
got friendly urls working today. (allowing [a-z0-9_\-].)

gonna wrap the rest of these issues up soon.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
haha.. google code is becoming more fun:
http://code.google.com/p/sappho/source/detail?r=11
lucas's avatar
16 years ago
link
lucas
i ❤ demo
down to 7 issues!
lucas's avatar
16 years ago
link
lucas
i ❤ demo
down to 5 issues!
lucas's avatar
16 years ago
link
lucas
i ❤ demo
three issues left!

here's a current working version:
http://www.wingedleopard.net/lucas/photos/
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
looks awesome.
lucas's avatar
16 years ago
r1, link
lucas
i ❤ demo
this post has been archived.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
thanks.

i have an rss feed with thumbnails in it. :)
dannyp's avatar
16 years ago
link
dannyp
dʎuuɐp
wow, look at that :D
Étrangère's avatar
16 years ago
link
Étrangère
I am not a robot...
I was looking through the bonsai pics you posted in the other thread, and I'm wondering why when I click "view next in set" it takes me to a black page with "about:blank" in the address bar.

That option must just be temporarily unavailable right now?
lucas's avatar
16 years ago
r1, link
lucas
i ❤ demo
this post has been archived.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
> a handful of things to do:
> http://code.google.com/p/sappho/issues/list

thanks for the post, though. :)
lucas's avatar
16 years ago
link
lucas
i ❤ demo
mootools is can hassing winnage.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
fuck i have to urinate frequently
DaGr8Gatzby's avatar
16 years ago
link
DaGr8Gatzby
Drunk by Myself
Is this going to be a program feature?

Feature List:

- S3 Backend
- Increases rate of urination (YMMV)
lucas's avatar
16 years ago
link
lucas
i ❤ demo
complete with a ymmv mootools slider
lucas's avatar
16 years ago
link
lucas
i ❤ demo
all done!

i just need to do some more qa at some point.

:D
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i think it's all pretty good now.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i should make a youtube video demonstrating how the back-end works with s3.
asemisldkfj's avatar
16 years ago
link
asemisldkfj
the law is no protection
do it!
nestor's avatar
16 years ago
link
nestor
nestor
i want to see the integration into wlw/lucas
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i have no idea how to do that. :o
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i'm declaring it stable!

i also notified the author of the s3 class that i used of my project. :)
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i got some wiki pages up:
http://code.google.com/p/sappho/w/list
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i'm having lots of fun with the project!

it's unique, it works well, and the code base is small and manageable.
lucas's avatar
16 years ago
r1, link
lucas
i ❤ demo
this post has been archived.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i don't think it's nearly usable enough.

i'm gonna put more work into user interface design this week.
lucas's avatar
16 years ago
link
lucas
i ❤ demo
i think i might go ahead and program sappho to use aws's "elastic compute cloud" to resize images:
http://developer.amazonwebservices.com/connec … goryID=175

i'd also code up a simple little script to upload photos.

so all you'd have to do is pull the high-res images from your camera, run the script on the directory containing those images, and you'd be set! :D
lucas's avatar
15 years ago
link
lucas
i ❤ demo
where should i put license information (e.g., "all rights reserved")?

example page: http://www.wingedleopard.net/lucas/photos/image/75/
bluet's avatar
15 years ago
link
bluet
inside "photo information", on the bottom
Étrangère's avatar
15 years ago
link
Étrangère
I am not a robot...
One of your photos is trying to undermine the system!
lucas's avatar
15 years ago
link
lucas
i ❤ demo
thanks! i renamed all of my photos, and i guess i screwed that one up.
lucas's avatar
15 years ago
link
lucas
i ❤ demo
i've marked the project as "stable for production use."

http://code.google.com/p/sappho/

:D
lucas's avatar
15 years ago
link
lucas
i ❤ demo
i just announced the software on amazon's s3 forum. i'm terrified of this level of publicity. :o

http://developer.amazonwebservices.com/connec … adID=28661
phi_'s avatar
15 years ago
link
phi_
... and let the Earth be silent after ye.
Congrats man!
lucas's avatar
14 years ago
link
lucas
i ❤ demo
how do i answer this?

http://code.google.com/p/sappho/issues/detail?id=31
bluet's avatar
14 years ago
link
bluet
> how do i answer this?

Honestly.
bsdlite's avatar
14 years ago
link
bsdlite
thinks darkness is his ally
> how do i answer this?

start by telling him that sappho doesn't generate thumbnails :)