Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbimg My attempt at photos…

  • Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    bbimg My attempt at photos…

    This is my first post in any sort of WordPress related project, and with me using it so much I finally wanted to start giving back. I have a few plugins and Ideas that I have been working on that I think I’ll just give away instead of hiding them away on whatever servers I put them on. I am starting to do a lot more work with elements that I cant find already made so I have to make them, but then I forget that someone else may need that same thing.

    With that, I am the webmaster of a small(3,000 users) site that is a social network for models and those in the modeling agency. Right now its totally free as we are building a userbase. Soon that will change as well as the engine we are running on. It is old, slow, I didn’t make it, and wont scale so I have been searching for a replacement and I was going to use JoomSocial, but I decided against it as I would rather foster this project.

    At the modeling website there are thousands upon thousands of images as that is the users primary resource and reason for being online. So I have decided to work on a plugin to handle the images and albums. I have written a outline in my project notebook, but would love some feedback. My plan is to update this thread as I progress.. I have a week until next semester so that should be plenty of time to get a beta out..

    Some of this is in coding format, but no real lines of code yet..

    HERE WE GO!!

    • First the user clicks add photos, a page loads with a single field and a MORE button.
    • once all photos are selected the user POSTS data to the same page.

      (note) More AJAX’y stuff could go on here, but I’m keeping it simple at first..

    • checks that file is image type, makes all lowercase, renames jpeg to jpg.
    • all files converted to jpg(or whatever file type)
    • Checks if height > width, then checks larger value against max_width/max_height.
    • Resizes with correct ratio.
    • sets image quality
    • Generates filename from userID and photokey such as 1234_15.jpg
    • Photo uploaded to image directory

    It keeps the data as session data and moves to creating a thumbnail

    • Admin sets weather to resize, crop, or scale images. Does so to set options
    • Thumbnail uploaded to thumbnail directory (SAME FILE NAME)

    Then comes what we are doing to the database.. I had TONS and TONS of ideas for this, and was trying to avoid creating MORE tables for each user, if they have a blog they already have 8!! So what I have done is added 4 fields to Usermeta, and created two sitewide tables called images and albums.

      Usermeta

    • Photokey – key that a user adds to each time a image is uploaded. No duplicate image names in a database or directory.
    • Albumkey – Same thing.
    • Albums – Names of albums user has created, this is to relive querys to other tables as usermeta is loaded automatically.
    • Tagged – This is ALL PHOTOS the user is tagged in, returns an array

    The larger of the two tables is Images, it holds all the data for each image in the directory.

    • Key
    • image name – I used 1234_15.jpg earlier.. extension could be left off..
    • user – this is so wp doesnt have to parse the image name.
    • active – When a user elects to delete an image it is first switched to inactive, this gives the user time to “un-delete” a file, while also allowing an administrator to remove all files in a single action reducing storage size and server load. I plan on doing this during lower traffic hours as a cron job.
    • albums – this is to reduce query load when someone wants to display the name of the album a image is in, and allows direct targeting of the album table.
    • date – timestamp when uploaded.
    • Caption
    • Comments – my plan for now is a hack job of a very long array.. I dont think anyone will max out a data field for a image with too many comments..
    • Tags – userid’s of those tagged.

    Then the Albums table:

    • key
    • Album name – userid_albumkey
    • userid – who made the album
    • Title
    • Caption
    • Comments
    • Date
    • active
    • List of image names in this album. Returns an array.

    WHEEEEW!!

    how to call it:

    • get_album(“id”, maxdisplay, number of tags, number of comments,); returns markup
    • get_img(“name”, options);
    • get_thumb(“name”);
    • get_img_data(“name”, options); if left blank all data is loaded as img_id, img_caption, etc..
    • get_tagged_img(); returns a list of all images person has been tagged in.
    • get_album_info(); same as img, useful if say you just wanted the names for a carousel or slider..

    Of course tagging would call an event or whatever BB uses for its “wire” I havent learned enough of that code yet but Its in the works.

    a user can un-tag themselves from any image, and it would remove it from the image database as well as the meta data. It would work the same when deleted..

    What do you guys think? What should I kill immediately, or what should I add? I will have a TON of configurable options for admins, but didnt want to post all that.

    Well thats it for now I guess, I’ll start coding the meat of it tomorrow..

    -Dennis..

Viewing 15 replies - 1 through 15 (of 15 total)
  • Avatar of Mike Pratt
    Mike Pratt
    Participant

    @mikepratt

    Dennis – I applaud your effort and sometimes I am convinced having multiple efforts on the same quest makes for better results. It may very well in this case as well but there are a couple of things to consider before you dive into a monster project like this. 1. Brajesh just released screenshots of his exact same project which is days/weeks from release (http://buddydev.com) Yes, there’s a fee but it’s nominal. 2. This looks like it might make it into core sometime this year.

    So you could get it right away for a small fee and avoid the work or you could wait until core (I prefer the former) Of course, the benefit for doing it all yourself is total customization to suit your own needs but making something for the community seems to be your priority so..

    Just food for thought.

    Gallery component should be implemented using the activity stream component and it’s activitymeta database storage. I believe this is the approach that the 1.3 Gallery component may take.

    Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    @DJPaul.

    I have read the brief now on what Andy is thinking for using activitymeta for all events, and I have figured a work around that would conform to that, but I am afraid of writing this full out on the current activitymeta tables structure only to have to have it changed up like crazy..

    Many of the fields in activitymeta would work, and I see the benifit of a central structure but I have to ask,

    Say all events are stored as activities, Blog posts, images being added, comments being made, etc for all members wont this create a ENORMOUS table within the database?

    I mean, on my site now there are 3,000 members with at least 5 photos each, so thats 15,000 images plus each has at least 1 album, most have more so lets just say 5,000 albums. Then those can have comments, tags, etc. On my small site alone we are adding over 70,000 records to that single table that also holds all OTHER data and comments. And because we would be relying on that stream for the length of the site I would imagine hitting over 1 million records in the activity stream within maybe 3 months of active use. probably WAY more if the site grows as we forcast…

    I think this would greatly reduce the response time of the database and jam up my average sized server…

    Or am I wrong?

    I need to move over to the DEV side of this and find the IRC channel..

    Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    Ok I have talked to a few folks including Andy and have started a bit on this..

    I am planning on releasing code for every feature as I go.. that way people can test what “works” before I get to far on whats ahead..

    I’ve also learned WP2.9 added some image editing features, although they are buried and have very little documentation on it.. I’m working on stuff now to simply modify BP to do the basics..

    My plan for right now is to introduce a “default” album for all members/groups/blogs and to modify the Avatar uploader to upload images into this album(similar to Facebooks default profile pictures album) Then allow users to see that album…

    Avatar of Mike Pratt
    Mike Pratt
    Participant

    @mikepratt

    any idea how your plugin might compare to the big gallery effort going on over at http://buddydev.com ? (see prev post in this thread) Just curious. I hate to see duped effort.

    Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    @Mike,

    I havent registered at buddydev but from some of the things I read I think he and I are going about things differently.

    First, I am needing this plugin for a site that I need, with that there are things that Brajesh wont be releasing on the first edition. And then it goes 3-6 months on that revision..

    I will be using Rackspace’s Cloud files, so I need a solution to use ANY file host be it local or remote, so I am working around that issue as a primary.

    Second is I will be needing tagging pretty much off the bat. One post said this was for later..

    My plan for tagging will actually allow any user/group/etc to to be tagged to any type of content provided it has a ID. Not just photos.

    Plus I am generating a “site ID” so a group and a user cant both have the same ID. Right now there can be user 33, Group 33, and Blog 33.. All unrelated.. this is a pain as every plugin or content would need a “entity type” for each tag, or a separate field for each type. With a siteID and a corresponding table its held in one place and accessed on the fly..

    I am also using the core 2.9 image editing, as well as a free java app to edit files in the client side(see facebook’s java app)

    I am not trying to compete (well directly) with Brajesh, his plugin looks great but there is some functionality that I need and would rather let other folks have the option to use it as well.

    Most of the code is actually already written itno WordPress 2.9′s media tools.

    For example, all of the image editing/uploading/unzipping is already core. The biggest thing is taking the content mapping OUT of a hidden blog post(right now all media is stored as a blog post within a users main blog, including avatars) and allow users who DO NOT have blogs to be able to use WordPress’s media tools..

    My current plans are:

    Created SiteID system(already done)

    add new tables to handle images

    give all users/groups a “home” album and then a “profile picture” album

    Modify how avatars are uploaded/added to the database

    modify/duplicate the media-upload to change the filepath and way files are uploaded to fit my needs

    I also plan to release what Ive done in smaller stages(for free). If I hit a worth wile release I may charge like $5 for it and maybe some type of support system, I dunno.. I may just give it away and begin work on other projects. ( once this is done I dont see many “new” features… Facebook has been the same for 5 years)

    Not to say I wont add new features, or continue support, just that I cant imagine more at this time..

    ok Im rambling..

    Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    Just in case anyone was wondering,

    all new users not assigned a blog get added to wp_1′s blog and all media uploaded gets directed there… Also, interesting to note that the default BP avatar does not store this data in any of the databases..

    edit: I think in may assume the end filename bpfull.jpg with the long key added, ill check that soon.

    A weird defect/fault I see right now is the “master” admin cannot add users to a different blog they are not admin of. For some reason right now my setup isnt sending email and as such I have to create the passwords in the admin menu, but cant change what blog they are with..

    Avatar of Peterverkooijen
    peterverkooijen
    Participant

    @peterverkooijen

    Please concentrate on writing BP plugins that connect with more mature open source gallery scripts like Zenphoto, Coppermine or the NextGen WP plugin, instead of starting yet another ambitious project from scratch.

    I use Zenphoto with the ZenPhotoPress plugin. I would love to have a ZenPhotoBP plugin, but I’d never use any of these new BP-only plugins and if Andy & co built a gallery into the core, I’d have to strip it out again.

    This Kaltura plugin may cover your needs if you need more BP integration – semi-commercial third party product.

    Avatar of dennissmolek
    dennissmolek
    Participant

    @dennissmolek

    ZebPhoto is a inetresting plugin that I’ll look at but the rest are based on a SINGLE blog system.. Many use “posts” to hold data just like WP does instead of actual management.. Coppermine is a general PHP gallery and not written to use WP’s basic toolset..

    and Kaltura was last written for 1.1 not 1.2

    Avatar of Peterverkooijen
    peterverkooijen
    Participant

    @peterverkooijen

    ZenPhoto is a inetresting plugin that I’ll look at but the rest are based on a SINGLE blog system.. Many use “posts” to hold data just like WP does instead of actual management..

    Not sure what you mean by “actual management”. My worry is that there will be lots of plugins that hook into BP-specific features, but are crap at what they’re actually supposed to do – processing/managing images, managing events, etc.

    ZenPhoto is not written to use WP’s basic toolset either, but it is a very solid and versatile gallery script. I’m saying it would be much more useful to develop a plugin the works as a bridge between a program like ZenPhoto and Buddypress.

    Kaltura was last written for 1.1 not 1.2

    1.2 is not officially out yet. Several key BP plugins are apparently already breaking on WPMU 2.9.1. Good luck staying up-to-date with your project…

    Avatar of designodyssey
    designodyssey
    Participant

    @designodyssey

    I’m watching this back and forth and wondering, what would be most successful long-term.

    My answer: Standardization. Otherwise, I find it hard to believe someone will keep such an ambitious project going. This will likely happen through inclusion in core or just adoption rates.

    Right now, I need a solution that works with BP, allows user-uploaded content and ties into third-party hosting. As WP moves more into CMS-mode, many of the “features” described in this post will be desirable for non-bloggers running large community sites. I think that for many nearly-free sites, creating large userbases is going to be a big problem in 6-12 months. I’m trying to plan around that problem.

    I posted my ideas of extending the Cincopa plugin at http://buddypress.org/forums/topic/creating-a-cincopa-gallery-plugin-for-buddypress. I’d love thoughts on that, but I’d support a commercial solution for support that solved my third party hosting issue.

    Avatar of @mercime
    @mercime
    Keymaster

    @mercime

    Personal preference is Amazon S3. Beyond that, the Gallery should be able to integrate streams from user’s Picasa albums, Flickr albums, plus YouTube and Vimeo videos in his/her BP Gallery/Album – now that will save on storage space on Site Admin’s end as well :-)

    Avatar of designodyssey
    designodyssey
    Participant

    @designodyssey

    @mercime

    Preacher meet choir.

    I’ll check whether Brajesh is dealing with the third-party hosting issue. I like the ideas presented here and we’ll just have to wait and see.

    @dennissmolek

    Are there plans for this plugin to work with Single WP too. I probably don’t go to production until about May-June. Any chance that meets your timeline.

    Avatar of Symm2112
    symm2112
    Participant

    @symm2112

    I’ve been talking with Brajesh and he’s already planning on working with third party hosting if you know what CDN you plan on working with. He’s already integrating flickr/youtube functionality so that it conserves space as I confirmed last night so that’s one less thing. Don’t know if that helps you or not but at least we’re not duplicating efforts about saving space on the host site.

    Avatar of designodyssey
    designodyssey
    Participant

    @designodyssey

    @symm2112. Tried to access the ‘private’ forum but I guess you have to be a paid member. Most sites that require paid membership have pre-sale questions thread to address these type of things. Might be a good idea.

    NEway, I’d be interested in seeing these efforts merged. They seem too similar to keep separate. If Brajesh has a longer timeline, maybe the development help can change that. It also sounds like Brajesh will have incentive to keep it going due to being compensated.

    Just a thought. We have so many other things that BP needs, I’d hate to see too much duplication. That said, if the functionality/use cases are different, maybe it’s justified.

Viewing 15 replies - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.