Johan Broddfelt

Image and video in posts

First of all I need a new column in my post table. I'll call it embed. This is where I will store the image or video-tag that should be added on top of my post.

ALTER TABLE `post` ADD `embed` TEXT NOT NULL AFTER `message`;

Then I just need to add the code that displays my embedded item in my post page.

// views/post/item.php
publish == '0000-00-00 00:00:00' and $user->status < 3) {
    Http::redirect('./');
}

$headerData->title = $obj->title;
$headerData->description = $obj->summary;
$headerData->keywords = $obj->tags;

?>
embed; ?>

title; ?>

message; ?>

posted; ?> - tags; ?>

...

I added the additional div with padding set to zero. This is because I want the image to fill the space all the way out to the borders.
And that is it. Now I can add an image like and it will fill the top of my post. The same goes for video make sure that it fills 100% of the width.

- framework, php, media, software

<< Administration pages
Follow using RSS
Modifying the list and edit forms >>

Comment

Name
Mail (Not public)
Send mail updates on new comments
0 comment