TwitterFacebook

New LGF Pages Feature: Attach a ‘Meta Image’ to Your Post

Get meta
LGF • Views: 11,579

Our free high-powered blogging system for registered users has a new feature today! To make sharing your LGF Pages on Twitter, Facebook, and Google+ more interesting and appealing, we now let you upload an image (called the “Meta Image” because you don’t actually see it in the post here at LGF) that will be automatically recognized by sharing services when anyone tweets a link to your Page. Here’s what a meta image looks like in an embedded tweet, for a video I posted yesterday:

Pretty cool, eh? To upload an image from your computer for the meta image, all you have to do is drag and drop the image file onto the “Upload Meta Image” button in the LGF Pages editing window. On mobile devices, when you tap the button it prompts you for an image from your camera library.

Here’s what the new Meta Image button looks like in Mac OS:

In the screenshot above, the meta image has already been uploaded, so you see a blue link with a check box for it. If you click that link, the image pops up for viewing.

Note that the LGF Pages editing window automagically picks a meta image on some sites like YouTube or Vimeo, or if you include an image in your post, but you can change it to something else if you want.

If there’s already a meta image attached to the post and you decide you don’t want one after all, just uncheck the box before submitting the post.

Tech Note: Using Media Queries With PHP

Communicating across the client-server divide
LGF • Views: 14,239

One of the major hurdles in a responsive mobile-friendly design is that the code that runs on your server (in our case PHP code) doesn’t have any simple way to get the screen dimensions of the user’s browser.

As a result, many mobile designs for PHP require the use of complicated checks for many different types of mobile devices, which is kludgy from a programming standpoint, and violates the whole ethos of responsive design, in which you program for screen size, not device type. And it runs the risk of breaking in the future as well, like all kludges based on user agents.

After wrestling with it for a while, I’ve come up with something that works for me. It’s not ideal in some ways, but it does let your server-side PHP code respond to a browser’s screen dimensions.

The big caveat is that this little bit of Javascript code must run as the very first thing in the <head> section of your HTML document, before any other Javascript and preferably before anything else.

From the PHP standpoint this has one drawback: if your PHP code needs to do anything specific to mobile devices before sending any output to the browser, you’ll still need to fall back on the messy user agent solution. But any PHP code that runs after this bit of Javascript will be able to respond to the screen size properly.

Here’s the code that goes in the head section:

<script>
if (matchMedia && window.matchMedia('(min-device-width: 320px) and (max-device-width: 480px)').matches) {
	document.cookie = 'smartPhone=1; path=/';
}
</script>

Here’s how it works: the latest versions of all the major browsers have a Javascript method that duplicates the CSS media query functionality, called “matchMedia.” You pass it the same kind of string you’d use in your CSS code, and it returns a “MediaQueryList” object; the matches property is true or false depending on whether the device matches the media query.

So this little bit of code first makes sure matchMedia exists, then calls the method with a string specifying smartphone-sized devices. If the matches flag is true, it sets a session cookie (expires when you close the browser window) called “smartPhone.” That’s all there is to it.

From that point on in your PHP code, you can simply do something like this to respond to the screen size:

<?php
if ($_COOKIE['smartPhone']) {
  // do your mobile stuff here
} else {
  // do your non-mobile stuff here
}
?>

This code is specifically written for smartphone-sized screens, but it could easily be adapted to support more screen sizes as necessary. I’ve found it very useful in building LGF’s responsive mobile design, so maybe it will come in handy for someone else out there in the Internets.

Also see:
Detect Mobile Browsers - Open Source Mobile Phone Detection
Using window.matchMedia to Do Media Queries in JavaScript - Mozilla Hacks - the Web Developer Blog

Open Thread (w/ Heartbleed News)

Heartbleedocalypse
LGF • Views: 11,345

I’ll need to put the LGF web server into maintenance mode for a short time, probably within the next 3 hours, in order to complete some work cleaning up the mess created by this nasty Heartbleed apocalypse you might have heard about. The good news is that our servers are completely patched against the bug, and our SSL certificate has been revoked, reissued and reinstalled. When all the necessary back-end stuff is complete, I’ll be asking all registered LGF users to change their passwords ASAP, but hold off until I give the signal.

It’s a really interesting mental exercise to exhaustively go though a server and identify everything that might be a security problem if it’s in the server’s memory. That’s what makes Heartbleed insidious — it essentially gives an attacker access to the server’s entire memory (in 64K chunks, with repeated requests), and when encrypted data is in RAM it’s in decrypted form. Basically, the exploit based on this OpenSSL bug makes everything that should be private on a server easily accessible if it’s ever read into RAM, and it leaves not a single trace of its filthy work.

In the meantime, here’s an open thread as I get things set up so this maintenance time can be as short as possible.

UPDATE at 4/9/14 6:01:18 pm

We went into and out of maintenance mode so fast you may not have noticed it, but LGF’s servers are now fully protected from the Heartbleed monster. Time to change your LGF passwords, folks.

And if you’re not already using 1Password, you really should look into it. It makes password management 271% less stressful.

Monday Night Open

When the going gets weird, the weird get going
LGF • Views: 13,358

Here’s a simple, unadorned open thread, on what can only be called a rather slow news day, as I continue going through the site and making things mobile-friendly. Next up on the list: LGF Spy mode, our live-streaming view of comment threads. In fact, it’s almost ready to launch…

LGF Mobile Updates: Upload Photos Directly From Your Phone

And much more
LGF • Views: 13,449

I got some good work done on the mobile version today:

  • The popup Image Library that lets you search, view, insert, and tweet your previously uploaded images is now fully mobile-friendly.
  • You can now upload images directly from your smart phone, by tapping the "Upload Image" button. You can choose to take a photo and immediately upload it, or pick a photo from your phone's camera roll.
  • There's now a button at the top of the screen that lets you switch to the full-size "Desktop Version," and a button to let you switch back as well.
  • If you tap an author's name in the Featured or Recent Pages lists, it now pops up the list of their last 5 Pages; on mobile devices this popup dialog has a big red X to let you close it.
  • The "live updating" features of LGF are now enabled on mobile phones, so you can see the count of new comments in a thread and other little things that update continuously for signed-in users.
  • Lots and lots of little tweaks to make things look better.

^ back to top ^

TwitterFacebook

Turn off all ads for a full year by subscribing!
For about 33 cents a day (per month) or 22 cents a day (per year), our subscription option turns off all advertisements at LGF!
Read more...

► LGF Headlines

  • Loading...

► Tweeted Articles

  • Loading...

► Tweeted Pages

  • Loading...

► Top 10 Comments

  • Loading...

► Bottom Comments

  • Loading...

► Recent Comments

  • Loading...

► Tools/Info

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published unless you request otherwise.
Tech Note:
Using the Contact Form
LGF Pages

This button leads to the main index of LGF Pages, our user-submitted articles. You can post your own LGF Pages simply by registering a free account with us.

Create a Page

This is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.

Last updated: 2014-03-07 2:19 pm PST

LGF User's Guide
Recent Pages
Randall Gross
OpenSSL Code Beyond Repair, Claims Creator of ‘LibreSSL’ Fork
OpenBSD founder Theo de Raadt has created a fork of OpenSSL, the widely used open source cryptographic software library that contained the notorious Heartbleed security vulnerability. OpenSSL has suffered from a lack of funding and code contributions despite being ...

7 minutes ago
Views: 20 • Comments: 0
Tweets: 0 • Rating: 0
FemNaziBitch
FLORIDA: Sex Trafficking Bill Clears House on Unanimous Vote
A bill aimed at responding to sex trafficking, with a laundry list of services and safety precautions to protect victims, passed the Florida House of Representatives on Tuesday with a unanimous 119-0 vote. The bill, if passed by the ...

2 hours, 21 minutes ago
Views: 49 • Comments: 0
Tweets: 0 • Rating: 0
cycroft
Russ Campbell’s Blog
Speak&shy;ing at a town hall in Nanaimo, B.C. on April 13, the Green Party leader called the PMO "a $10-mil&shy;lion-a-year par&shy;ti&shy;san op&shy;er&shy;a&shy;tion filled with ruth&shy;less, cut&shy;throat psy&shy;chopaths." Eliz&shy;a&shy;beth May, MP for Saanich-Gulf Is&shy;lands, later claimed she made the com&shy;ments ...

3 hours, 16 minutes ago
Views: 31 • Comments: 0
Tweets: 0 • Rating: 0
Skip Intro
Tea Party Candidate Curt Clawson Wins Republican Primary to Replace Former Rep. Trey Radel
Curt Clawson, a businessman who was little known months ago in Southwest Florida, won a contentious GOP primary Tuesday to fill the U.S. House seat left open by the scandalous downfall of Trey Radel. Clawson pitched himself as an ...

19 hours, 45 minutes ago
Views: 177 • Comments: 0
Tweets: 7 • Rating: 0
MichaelJ
2014 Rip Curl Pro Bells Beach - ASP - Finals Day!
More: 2014 Rip Curl Pro Bells Beach - ASP The women's final is in the water now and the men's quarterfinals begin after a champion is crowned. Bells beach is delivering the goods today with clean conditions for the ...

20 hours, 18 minutes ago
Views: 68 • Comments: 0
Tweets: 1 • Rating: 0
Political Atheist
NYT Story-American Middle Class Is No Longer the World’s Richest
After-tax middle-class incomes in Canada -- substantially behind in 2000 -- now appear to be higher than in the United States. The poor in much of Europe earn more than poor Americans. The income data were compiled by LIS, ...

1 day ago
Views: 147 • Comments: 0
Tweets: 0 • Rating: 2
palmerskiss
Debate Discrimination - Houston Chronicle
We're glad to see Mayor Annise Parker finally stand up and propose a human rights commission that will provide local due process for victims of public discrimination. Parker told the Chronicle editorial board that she plans to release a ...

3 days, 23 hours ago
Views: 226 • Comments: 0
Tweets: 0 • Rating: 0
Idle Drifter
Calgary stabbings: How knife crime in Canada can cause ‘moral panic’
What Calgary police chief Rick Hanson called the "worst mass murder" in the city's history didn't end at the barrel of a gun. Instead, the 22-year-old suspect identified on Tuesday as Matthew de Grood is accused of entering the kitchen ...

6 days, 14 hours ago
Views: 377 • Comments: 6
Tweets: 0 • Rating: 0
aagcobb
New York Electoral College: State Joins National Popular Vote Interstate Compact.
Ben Mathis-Lilley, Slate: New York Electoral College: State Joins National Popular Vote Interstate Compact. Instead of pushing for a Constitutional amendment, which would have to be ratified in 38 states, advocates ask individual state legislatures to pass an agreement: that ...

6 days, 20 hours ago
Views: 364 • Comments: 8
Tweets: 0 • Rating: 2
iossarian
Drug Companies Want Your Money
Two thematically-related stories on the BBC at the moment: UK drug company Glaxo 'paid bribes to Polish doctors' UK drug company GlaxoSmithKline is facing a criminal investigation in Poland for allegedly bribing doctors, BBC Panorama has discovered. Tamiflu: Millions wasted ...

1 week ago
Views: 361 • Comments: 0
Tweets: 8 • Rating: 0
 Frank says:

"Conducting" is when you draw "designs" in the nowhere -- with your stick, or with your hands -- which are interpreted as "instructional messages" by guys wearing bow ties who wish they were fishing.