Rails adding images to a Post - ruby

I have a Rails app for blog posts.
Each Post has a title and the blog_text. I want to be able to add images to the blog post as well while i'm creating the blog post. What's the correct way to do this?? Would I just create another migration to add blog_photos so the post has_many blog_photos??
Or should i install a good markdown editor for the blog_text??

It depends on how the images are to be used. Here are two scenarios:
The images are meant to be inside the blog text and added by the user. For this scenario I would use ckeditor (https://github.com/galetahub/ckeditor). This will give the user a WYSIWYG editor and allow them to upload images into the blog text (CKEditor will create two models for attachments).
The images are specific header/icon images for a specific purpose and not contained in the blog text. In this scenario I would use either paperclip (https://github.com/thoughtbot/paperclip) or carrierwave(https://github.com/carrierwaveuploader/carrierwave) and depending on the specific use case would add the image directly to the post model or create a separate model BlogAttachment (if you need a one to many relationship).

Related

How to upload an extra image on new discussion and use as featured image of discussion?

For a project I'm developing with Vanilla forum, I want to have option to allow user to add featured image in Vanilla forum post. I want this featured image to be displayed on homepage along with all the posts that are displayed by default (without any featured image).
As I'm relatively new to Vanilla forum development, I'm unable to figure out:
How do I provide user the option to upload featured image with each post at the time of posting new? I've tried using file upload plugin, but this inserts image in "gdn_media" database table having no connection with discussion ID.
How to customize select query of Vanilla forum to retrieve additional field, if I had to get featured image say from media table or a custom-made table of mine?

Incorporating BBCode in Laravel 4

Is it possible to incorporate BBcode in Laravel 4? Im creating a blog site with admin and user side and I want to try using bbcode to embed images and videos in the user side. If not, do you know other ways to do this (embed images and videos)?
i once used golonka/BBCodeParser package, which did the job perfectly.

Docpad design considerations

I'm coming from a php/mysql background. I'm most familiar with the Kohana PHP framework and I'm trying to learn Docpad. I have a loose understand at this point and I've built out my first website and blog. Static content makes a lot of sense to me on Docpad.
I'm working on my photography site where I want to be able to upload new images to a portfolio. The backend needs to handle an uploaded high-resolution image and create several different copies at different resolutions of the image. My biggest question is how do I keep track of the image meta data that I want to display? Do I generate a physical file for each image that has all the particulars I want to track and use those files as my searchable database, much like how blog posts are setup?
Or should I go the route of using something like MongoDB to store image data there where it can be queried and plugged into a layout?
Regarding handling POST or GET data, should I be reading up on the express.js docs? I'm not really sure where to turn for that.
Wordpress uses TimThumb to re-size it's images: How does WordPress.com resize images dynamically?
Then there is this re-sizing library for node: node package for file attachments and image resizing
If you wanted to created like 3 different image sizes and use the backbone collection in DocPad, then you'd add your different re-sized images to those three different collections/folders. For access the images you might just be able to do it via it's file name. So when you copy, re-size and rename the image, in the rename step, concat the image size at the end, like: coolPhoto-med.jpg and then you could just do hard links to get to the image like /spring-collection/med/coolPhoto-med.jpg or you could use query engine to access them.
The file model has a meta attribute: https://github.com/bevry/docpad/blob/master/src/lib/models/file.coffee#L17
I've yet to learn how to use it yet though.
I know we chatted yesterday on #docpad IRC but I just wanted to answer you here too. If you do code something that re-sizes images for DocPad, please do consider putting it up on Github to share with the community.

image media and custom post type in wordpress

I am looking for some help / thoughts. I am building a travel site for a client who will continue to add content to the site when it is finished. At the moment there are 600+ images, just in one region, when the site is up and running there will be over 20 region's, and so a lot of images. Is there a way to section the images so that when the client wants images from the USA, that is all they see in the "Insert Media" window. I am using Custom Post Types for the sections. Does anyone have any thoughts and advice.
I would hope there is a plugin to achieve this, as to be honest I do not want to mess around with any core files in PHP.
Thanks
John
For your issue, you can separate images in post.
For example, Create one post USA and upload all USA region related images into it and there is one option in media to view all images from post.you can create multiple post for multiple region.
And Even you can fetch all images from single post too in wordpress.
Hope this helps.

Drupal: storing images and other module data

Suppose we have a module that displays tables of employees. Each employee has a photo. What is the best way to store this photos and display them?
I mean, is there some kind of content repository in drupal? I don't want to do this manually, maybe there is an API that can store images and then generate links to them and so on.
Thanks.
The Content Construction Kit(CCK) / Fields in core is what you want to explore.
Using CCK you can attach an image, a number field, a file, some text, a reference to content, etc to another piece of content.
In Drupal 7 you can add fields to any entity (Content, User...your custom one(Employee)), in Drupal 6 you might want to explore Content Profile
Further Reading:
http://drupal.org/node/717120
There is a kind of content repository in Drupal: both in the database and as storage (disk).
The API for that is documented in a special File upload section.
If you want inspiration, the core module called upload.module can serve as example. But be aware that Drupal core, for several reasons, is far from the best and cleanest examples to learn from.
What you are looking for is CCK module with file-field and image-field modules for handling the image upload action.
And for the display of those uploaded images you should use Image-cache

Resources