Showing posts with label Tech. Show all posts
Showing posts with label Tech. Show all posts

Sunday, September 23, 2012

Resize Landscape or Portrait Images in Photoshopt for 4x6 Print

The last part of my workflow is exporting the images out. I usually I either export out the images at full resolution or 8x12 at 300. The tricky part is that if I need to resize to 4x6 I can either re-do the export again in Lightroom which will take a long time or use Photoshop to batch process the already rendered JPEG photos.

Two ways to resize images for both Landscape and Portrait images for 4x6 prints

1) Use Fit Image under File -> Automate -> Fit Image.



The Fit Image screen will show up with Height and Width which is very misleading

It's not clear but the text really means is constrain the image dimension height and width to the longest side.  For this example if an image is landscape the longest Width will be 1800px or if an image is a portrait the longest height will be 1800. It DOES NOT mean to constraint the height and width to 1800 to make a square image.

End result of a Landscape image should be something like this:




End result of a Portrait image should be something like this:




Notice the Maximum Width and Height, they both fall under our constraint of 1800px.

2) To batch job the whole thing Image Processor makes quick work of the images using the same dimension concept as in Fit Image.


Now I can resize all the image I want to print in one folder or open the up in photoshop and batch process the whole thing without having to create my own actions.


You can also save at the same location but it's smart enough to create a new folder so your old images will not be overwritten.

Saturday, September 8, 2012

Facebook plug-in for Wordpress

Completing the Facebook Plugin installation is no easy task as the last part is to submit the 'Publish' action to allow Wordpress to auto publish posts. If you're having trouble here is :

How to Publish to Timeline


Review the official instructions from Facebook first: https://developers.facebook.com/docs/opengraph/tutorial/

There are additional instructions here that helped me. http://onlytipsandtricks.com/facebook/how-to-publish-actions-on-timeline/

However, the code used in there did not work for me and failed.  After many hours spent playing around with the code I have the following:


<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="[YOUR_APP_ID]" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Sample article" />
<meta property="og:image" content="http://nopenonlytext.tnguyen.com/wp-content/uploads/2012/09/maui-2012.jpg" />
<meta property="og:description" content="Sample object Publishing" />
<meta property="og:url" content="http://nopenonlytext.tnguyen.com/test.html">

<script type="text/javascript">
function postPublish()
{
FB.api(
'/me/Publish',
'post',
{ article: 'http://nopenonlytext.tnguyen.com/test.html' },
function(response) {
var msg = 'Error occured';
if (!response || response.error) {
if (response.error) {
msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message;
}
alert(msg);
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '[YOUR_APP_ID]', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};

// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>

<h3>Sample Object</h3>
<p>
<img title="Maui"
src="http://nopenonlytext.tnguyen.com/wp-content/uploads/2012/09/maui-2012.jpg" />
</p>

<br>
<form>
<input type="button" value="Publish" onclick="postPublish()" />
</form>
</body>
</html>


You can see the complete code also here from when I created the test page.
http://nopenonlytext.tnguyen.com/test.html

I hope this helps but feel free to ask me any questions.

As I'm having issues preserving the HTML code I have in this post since switching to "Visual" from "HTML" reformats the HTML code. I have attached the HTML code for reference when I find that it's all mangled I can revert it back.
html-code-for-post

Friday, August 3, 2012

Transfer Compact Flash (CF) Card Photos to iPad

If you've read my other posts about transfering photos wirelessly to your iPad I've mentioned how wonderful it is and at the same time how unreliable it is if your camera uses CF and not SD.  This is my workflow process of how to transfer files from my CF card to my iPad.

Why am I going about this laborious method?

  1. The Eye-Fi card is too unreliable when using SD to CF adapter.  I constantly get errors when writing and reading to the card.  Did I just lose all my photos? WTH just happened? Why can't I see my photos! It freaks me out when doing important photoshoots!

  2. The Eye-Fi is too slow when writing to the card. The camera has to buffer the images and I have to wait for the write to finish. I have the Canon 5D Mark II card, a basic Raw image is already 20MB+ not including JPEG processing.

  3. On important shoots I like to take RAW+JPEG, when inserting the CF card into the iPad the OS sees both RAW+JPEG and thus downloads everything.  That's about 30MB - 50MB a photo, I don't have that kind of space in the iPad or the TIME to wait!

  4. This is the most reliable way for me to transfer images from my CF card into the iPad without any hick-ups. Works every time. I don't have to wait for Eye-Fi to transfer or look for the wireless pairing or care about read/write errors. I don't have to worry about running out of space. Worry free every time.

  5. Peace of mind knowing that I still have all my photos.


When using the CF card and iPad CF card reader the following is displayed



iOS knows that I have taken RAW+JPEG together and will therefore import both files and not just let me import the JPEG fail.  See above description of why it's a fail.

 

NOTE: This only works for JailBroken iPads and you have the CF reader.  As of this writing this worked for JailBroken iOS 5.1


To circumvent the above issue I prefer to use shareware app called iFile since it gives me the exact file structure and ability to read from my CF card.


Here are the steps to transfer files from the CF card using iFile.



Step 1



 I open iFile and click on the 'Shortcuts' at the bottom and select Flash Drive which will show the files from the CF card.



Step 2



If the files are not grouped click the Preference button and 'Sort by Extension'.



Step 3




Hit the 'Edit' button at the top left and select the JPG images.

Step 4




Click the 'Clipboard' icon and select 'Copy/Link'

Step 5




Navigate to directory /var/mobile/Media/DCIM/101APPLE

You can also use tabs in iFiles note the '3' in above image, it showing that there are three tabs, see below. It helps with traversing between different folders.


Step 6




Click on the 'Clipboard' icon again and 'Paste' the previously copied photos.

Step 7




Navigate to /var/mobile/Media/PhotoData

Step 8




Click the 'Edit' button at top right and select the Photos.sqlite and PhotosAux.sqlite file.

Step 9




Delete the selected SQLite files.

Step 10




Now open up the photo app and it will regenerate the SQLite files and generate the thumbnails again.  If the photo app is already opened close it out and restart it.

From there you should see your photos.  Thanks for reading!

Wednesday, July 6, 2011

Updating iPhone 4 to 4.3.3 with Error 3194

With the latest Jailbreakme 3.0 just out this morning you might be running into problem trying to update your iPhone to iOS 4.3.3.



If you're trying to update your iPhone 4 through iTunes and you're getting the error 3194.  Apple tells you to update to the latest iTunes but that will still fail.  There are a few things you can do to fix error 3194 while updating to 4.3.3 for your iPhone 4.

Option #1

First try this quick fix for error 3194.  Go to C:\windows\system32\drivers\etc and locate the “hosts” file.


Open it with NotePad and look for something that says "apple".  Put a # directly in front of the ones that have apple or iTunes in the name

e.g.

#74.208.105.171 gs.apple.com
#127.0.0.1 gs.apple.com



Make sure there are no entries that has apple or iTunes, otherwise this fix will not work.  You do not need to reboot or reload iTunes, just run the update/restore again.

Option #2

Download TinyUmbrella from TinyUmbrella Website
Launch it the app.
Click on the “Advanced” tab.
Uncheck “Set Hosts to Cydia on Exit”
Click on “Apply Changes”
I'm not sure if this one is necessary but you can try to Reboot your PC/Mac.


Then now try to complete the update.

Just One More Issue to contend With



Once you get iOS 4.3.3 installed on your iPhone 4 without error 3194 and you'll have problem with the JailbreakMe 3.0.  When using the Jailbreakme 3.0 cydia will disappear during the installation.  Cydia will appear initially and then disappear before it has completed the install.  This might be a minor bug but the fix for this is to load up iTunes once more, do a restore on your phone (pain the butt, I KNOW!). Once the restore has been completed go back to JailbreakMe.com again and install Cydia.  Hopefully Cydia will completely be installed without disappearing.  Now you're good to go!

Good luck and I hope this helps anyone that finds this because I've spent alot of time googling all of the individual problems and I've put them all together here to help anyone that runs into the same problems.

Tuesday, July 5, 2011

iPad 2 as external monitor with camera. iPad tethering. UPDATE

I know this post has been long overdue but I thought I should put this together since I know many people have been curious about the eye-fi card with Canon 5D Mark II (5DMII).  There are actually plenty of resources out there but it's quite difficult to track it all down and get precise information.

How to shoot tethered with Canon 5D Mark II with an iPad using the with Eye-Fi pro x2.  Since Eye-Fi Pro currently does not make any CF cards for the 5DMII you will need to get a SD to CF Adapter.  As of right now Eye-Fi is not officially supporting the use of adapters but they have shown that the following adapter will work.

You can find the CF to SD adapter at amazon here: http://www.amazon.com/gp/product/B004K079UU

The important about this adapter is that the 5D Mark II is a UDMA camera and this will allow the SD card to be read inside the camera.  If you want to read more about this SD to CF adapter read here: http://forums.eye.fi/viewtopic.php?f=8&t=1352&start=30

The other thing is of course the Eye-Fi 8GB X2 Pro.  You will need the X2 Pro, it's the only one that will work with RAW images.  So when you take photos, you will need to capture in both RAW + JPEG.  The JPEG images will be the one that will transferred directly to your iPad.

Next, using Eye-Fi Direct Mode or Shuttersnitch.  Both have their own pit falls but I'll provide you with some feedback as I've used them both.  I'll start with the easier and simpler option.

Shuttersnitch VS Eye-Fi Direct Mode


Eye-Fi Direct Mode Review: 

Pro: The software is free and works for both iPhone and iPad.  The software is easy to install and configuration is not too bad just as long as you follow their instructions, there are only a few steps.  The Eye-Fi card will create it own hotspot so your camera can connect to it to allow the photos to be transferred to your device or PC. 

Cons: The tricky and hard part is for the Eye-Fi card to pair with either your  iPhone or iPad.  You will have to load up the app on iPad/iPhone, start taking photos, and then the Eye-Fi card will create it's own Wi-Fi hotspot.  Caveat to that according to Eye-Fi, it will only create a hotspot if there are no other Wi-Fi signals around.  STUPID! No matter where I go there are always Wi-Fi signals around and it will inevitably cause problems. 

IF and WHEN the  the hotspot does shows up, the Eye-Fi card will be paired with the iPhone/iPad and you can start transferring your images.  Due to large battery consumption the Wi-Fi hotspot will shut off after a minute or two of being idle.  You will have to try to pair it again, a tedious process as you do not have control of when or how long the Wi-Fi hotspot is enabled.   I find that to be the biggest issue as I usually spend time taking photos, setup for the next shot by posing my subjects, or moving to another location nearby.  By the time I start taking photos again, the Wi-Fi hotspot is gone and I have to wait to see my photos again to be transferred.

NOTE: I have yet to test out the feature in which the Direct Mode will connect to a external wireless connection and use it to upload photos.  This will by-pass the need for the SD card to create it's own unstable WiFi signal.

Shuttersnitch  Review: 

The cons in this method will deter many users, so I will describe it first before I mentioned why I prefer this methodology.

Cons: The app now as of this writing is $15.  To simplifier the configuration and remove extra equipment, your device iPad / iPhone will need to be jailbroken to install the MyWi app.  The MyWi app will allow you to create your own WiFI hotspot without the need of  using a wireless router or other devices to create a wireless hotspot.  Unfortunately the app is $20, but MyWi is such a great app in general, and I used  its other features so I did not mind spending more money for it. 

Shuttersnitch currenly does not have any written manuals but it has a Forum with instructions on there.   You're stuck have problems? Check the forum, still no solution?  Feel like giving up?  Read the reviews on the app and many have ran into this scenario many times, it's an expensive lesson. 

As of this writing from reading the forums and issues, when taking RAW + JPEG photos, Shuttersnitch will transfer both the RAW and JPEG and not just the JPEG! Yes it's going to try to transfer a typical 30MB Canon 5D Mark II RAW file even though your iDevice will not be able to read it.  That is why your transfer is going to be slow and at times suck!  This is just how the current works because when it sees the RAW+JPEG combo it sees it as a combo and download them together. 

Pros: Configuration is relatively easy, as I'm an IT person I was able to figure out how to go about pairing my Eye-Fi card to Shuttersnitch.  What makes Shuttersnitch so great is that once you pair it with MyWi with a stable Wi-Fi hotspot that is on at all times and pair it with your Eye-Fi X2 Pro.  Once you take a photo it will appear on your device and there are no issues.  It always appear and has everything available to you.  Just that simple no issues transferring it just works as expected, BUT the MyWi will drain your battery.  It's a sacrifice I'm willing to make since it so much smoother!

 Overall: I think the technology is great and being able to wireless transfer images from my device from the camera is great.  I've found it to be a headache as the Eye-Fi X2 Pro will sometimes give me error messages that it's unable to read the data.  I have to turn off and the camera on.  Or it's too slow to save my images as I take bursts of RAW images.  I've almost given up on the whole wireless idea and started using the MIC iPad CF card reader.  Now I take my photos, transfer them at the end to my iPad, review them all at once.  No other apps to deal with easier and more consistent but not perfect.  Sucky part, $30 from China and no refund! 

Tuesday, April 26, 2011

Grainy - Pixelated photos on Facebook.



I haven't really notice the quality of my photos much on Facebook as they are relatively good until tonight. Every photo I uploaded was grainy and very pixelated. I knew it had something to do with the compression but not sure how to fix it. With a little search I found an easy solution.

1) Change the PPI (pixel per inch) to 120, DPI (Dot per inch) if printing
2) Change longest dimension to 720 px, the other side should be 480 px if it's 4x6 dimension



That should be it. If you have multiple images Photoshop can automate it by going to File -> Automate -> Fit Image

Now your images should look relatively decent and enough for low Rez images sharing on Facebook!



You can read a more thorough explanation here: http://www.damiensymonds.com.au/art_facebook.html

Friday, April 8, 2011

iPad 2 as external monitor with camera. iPad tethering.

Do you currently own an iPad or iPad 2 and want to be able to view your photos directly on the screen as you shoot?  Wouldn't it be cool to directly tether your camera to the iPad or iPad 2 for larger external display? There are currently a few options out right now and most of them are available for the original iPad. I haven't found anything yet with the iPad 2.

The option is to use an Eye-Fi Pro, jailbreak iPad to use the "MyWi" app to create a ad-hoc wireless network, and the app "ShuttSnitch". As of right now photographer David Ziser has found a way to shoot tethered, images from his Canon 7D are sent to the iPad 2. He takes it one step further by then connecting the iPad 2 to a projector to have an even larger image for others to see. He hasn't given his secrets yet but I'll be sure to post it once I learn of it.

View the video below:


How To Directly Tether Your Camera To An iPad By Lee Morris

You can learn more from the source here: http://fstoppers.com/ipad

Update: Please see my updated post on this topic!

Saturday, July 31, 2010

Canon Digital Photo Professional Download - Install

I just recently took some photos with my 5DMII and created my first Lightroom 3 catalog.  As always the color profile for canon photos are just an approximation so the colors and everything is always off within lightroom.  Being disappointed I wanted to see how Canon Digital Photo Professional will render the images.  I tried to see if I had the software but unfortunately I couldn't find the CD.  I Googled around for the software but it doesn't exist.

For some reason Canon's software distribution policy only provide the full version of each software from the CD and updates are available online.  When installing the updater it will require to have the software listed like below:



There is a way to work around this issue since the updater contains the FULL software itself.  You can fool the install by updating your registry.  This registry update is a minimal risk.  Here are the task.

For 32Bit Windows (XP, Vista, and 7) - Copy the following exactly below:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\EOS Utility]
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\DPP]
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\ZoomBrowser EX]
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\PhotoStitch
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\EOS Capture]
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\EOSViewerUtility]

For 64Bit Windows (Vista, and 7) - Copy the following exactly below:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOS Utility]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\DPP]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\ZoomBrowser EX]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\PhotoStitch
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOS Capture]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOSViewerUtility]

Copy and paste into NotePad.  Save the file as canonupdate.txt and then rename it to canonupdate.reg.  Then right click and select "Merge" on the context menu.



You'll probably get the following messages:



Success!!



This is what your registry should look like for 32Bit Windows:



This is what your registry should look like for 64Bit Windows:



Now when you run the updater you should get the install screen like below:



The source of where this information is at the following.  I've made my own updates to the instructions because it's not too clear on the website and provided my own version of the possible solution.

http://www.northlight-images.co.uk/article_pages/install_canon_software.html

If you run into any questions please email me and I will try to help but I hope the instructions here are complete and will work well for everyone.

Wednesday, July 28, 2010

iPhone - Cannot Connect to YouTube

For some reason I ran into this issue and I've spent the past couple of days trying to fix it. There are a couple of solutions and they all seem complicated and hopefully can I can help some ppl out. I know I'm a late technology adapter as I'm still using the original iPhone when the iPhone 4 has been out for a month now.  I"m a bit behind the times I supposes.  Running version 3.0 OS.

Please use the instructions I have below. The fix involves installing PushFix from Cydia.

Installing PushFix v1.0 - Steps
1. Load Cydia
2. On the main Cydia screen select "More Package Sources"
3. Select iPhoneModding
4. Select Install and Confirm
5. Go back to Cydia
6. Select the bottom Manage tab
7. Select Sources
8. Look for and select iPhoneModding
9. Look for and select Push Fix
10. Install Push Fix

One caveat that I've ran into for PushFix 1.0 that I believe is a scam is that this fix has one certificate for all users. For that reason I was receiving push notifications from other users on my FaceBook account even though I have all notifications turned off.

There are two solutions to the above, buy (~$4.99) and upgrade to PushFix 2.0 which creates a unique certificate for everyone (hence why I called it a scam).

The other option is try the following, which will require some work to remedy this situation.  You'll need to install OpenSSH, ToggleSSH, and MobileTerminal from Cydia.  You can use the search option to complete this task.

For the rest of the steps try the following PDF. Some of the steps might be repetitive but it should help resolve some of the issues.

http://www.vanravels.com/blockedyoutube/blocked%20youtube%20on%20%20iphone.pdf

or find it here below:

blocked youtube on iphone

I would like to give credit is due that is why I'm providing a link. Two notes though, the tutorial forgot to mentioned to install OpenSSH and ToggleSSH to allow WinSCP to connect with the iPhone. That was what was causing most of my problems. The default password is 'alpine' without quotes so it should work.

Tuesday, May 11, 2010

Single Image Fade In - Fade Out

If  anyone has visited the Boston Globe website and seen their "The Big Picture" page you would be awe struck by the amazing photographs.  I always go there to see the amazing photos around the world and just makes me feel humble and pathetic about my photography skills.  I guess it gives me something to strive for.  For now I know that my photography knowledge might not be as skillful but at least I know how to extract code that I believe is quite effectively used.

If you visit the Earth Hour 2010 page from Boston Globe they have a great way of transitioning images from dark into light.  Great setup and I thought it was skillfully executed.  From a developer point of view I wanted to see the JavaScript involved in fading one image into the next that seems to work across IE and Firefox without any glitches so I started to dissect the code and here is what I found.

The main JavaScript use for fading is very small and simple:
<script>

var isFading = 0;

function setOpacity(obj, opacity){opacity = (opacity == 100)?99.999:opacity;obj.style.filter = "alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity = opacity/100;obj.style.MozOpacity = opacity/100;obj.style.opacity = opacity/100;};

function fadIn(objId,opacity,sc){if(((sc==1)&&(isFading == 0))||(sc==0)){isFading = 1;if (document.getElementById) {obj = document.getElementById(objId);if (opacity >= 0){setOpacity(obj, opacity);opacity -= 10;window.setTimeout("fadIn('"+objId+"',"+opacity+",0)", 100)}else{obj.style.display="none";isFading = 0}}}};

function fadOut(objId,opacity,sc){if(((sc==1)&&(isFading == 0))||(sc==0)){isFading = 1;if (document.getElementById){obj = document.getElementById(objId);obj.style.display="";if (opacity <= 100){setOpacity(obj, opacity);opacity += 10;window.setTimeout("fadOut('"+objId+"',"+opacity+",0)", 100)}else{isFading = 0}}}}

</script>

I honestly don't care too much about understanding the code other than just knowing that it works. The next part was just calling the fadIn or fadOut functions.
<a href="#" onclick="this.blur();fadOut('imgA',0,1);return false">
<img src="img_off.jpg" style="height:658px;width:990px;border:0px;" /></a>
<br/>
<div style="margin-top:-658px;height:658px;width:990px;position:relative;" id="imgA">
<!-- the initial picture to display -->
<a target="_new" href="img_off.jpg" onclick="this.blur();fadIn('imgA',100,1);return false">
<img src="img_on.jpg" style="height:658px;width:990px;border:0px;" /></a>
</div>

Well after looking at how the fadIn and FadOut functions are called I saw what the trick or illusion is.  If you look at the div style attribute you will see the -658px value and that is where the trick lies.  Initially I thought the JS script was going to retrieve the next image and fade it in but this is even better, there won't be any delay of waiting for an image to download it would just work.

Here is how it works just to make it clear, HTML is rendered sequentially and the first image that is rendered is img_off.jpg and img_on is rendered right underneath.  Since the div has the top-margin style attribute of -658px (the height of the image)  for img_on.jpg it will overlay img_off.jpg.  In-essences they are stacked on top of one another.  The JavaScript is only changing the opacity to fade out one image and revealing the other.  I hope all that made sense if you even wanted to understand what's going on.  For the lazy people like me.   Here is the complete code that you can simply use to test it out.
<div>

<a href="#" onclick="this.blur();fadOut('imgA',0,1);return false">
<img src="img_off.jpg" style="height:658px;width:990px;border:0px;" /></a>
<br/>

<div style="margin-top:-658px;height:658px;width:990px;position:relative;" id="imgA">
<!-- the initial picture to display -->
<a target="_new" href="img_off.jpg" onclick="this.blur();fadIn('imgA',100,1);return false">
<img src="img_on.jpg" style="height:658px;width:990px;border:0px;" /></a>
</div>

<script>
var isFading = 0;

function setOpacity(obj, opacity){opacity = (opacity == 100)?99.999:opacity;obj.style.filter = "alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity = opacity/100;obj.style.MozOpacity = opacity/100;obj.style.opacity = opacity/100;};

function fadIn(objId,opacity,sc){if(((sc==1)&&(isFading == 0))||(sc==0)){isFading = 1;if (document.getElementById) {obj = document.getElementById(objId);if (opacity >= 0){setOpacity(obj, opacity);opacity -= 10;window.setTimeout("fadIn('"+objId+"',"+opacity+",0)", 100)}else{obj.style.display="none";isFading = 0}}}};

function fadOut(objId,opacity,sc){if(((sc==1)&&(isFading == 0))||(sc==0)){isFading = 1;if (document.getElementById){obj = document.getElementById(objId);obj.style.display="";if (opacity <= 100){setOpacity(obj, opacity);opacity += 10;window.setTimeout("fadOut('"+objId+"',"+opacity+",0)", 100)}else{isFading = 0}}}}

</script>

</div>

**Note: The important thing is to set the correct height and width for your images so that they will overlay/stack on top of one another properly.  To ensure a seamless fade I had to adjust the "top-margin" value.  You'll have to play with the value until you think it looks correct.  A sample of this can be found on my photography blog.

Friday, April 2, 2010

Photoshop - Content Aware

There has been alot of hype lately with so much talk about the new Photoshop 5 content aware fill features.  See below:



I've seen this concept before and I thought it was amazing and brought me back to my Computer Science background. It made me wonder how they would visualize the image to be able to understand the content around it to make the fill. This this video showed up on a site that made it clearer:



It discusses Seam carving or Content-Aware Image Resizing (CAIR) at a technical level and more importantly the features of which I've been trying to do with some of my photographs. All of this new revelation blew my mind. I think what made it even more amazing was after looking it up on wikipedia, Photoshop has acquired this technology and it some of it's feature currently exist in Photoshop 4!!!!

Now if you do a some googling around you'll find sites like this Digital Photography School which provides a pretty good tutorial of how to do.  I think this is going to keep me busy for a while!

This is the video that blew my mind when it first came out. This was before the sneak peek from Photoshop 5.

Monday, March 15, 2010

Displaying HTML Source Code in Blog Post

From the previous post I had a hard time displaying the HTML code that I was using.  Of course initially I thought I could easily just do a plug and code but I made two mistakes.

First mistake was that it would be easier if I plug the code into the WordPress text editor and it would convert the code for me and not interpret the code.  The other is that display was ugly.

To resolve this situation use the following HTML tags:
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks
</pre>


<code>
This will not preserve spacing or formatting and display text as is.
</code>


W3School is great for all of this HTML code and CSS reference.

If you're not using WordPress and just want to display HTML code without it being interpreted you will need something to recode those special characters and symbols. I found this neat site that will convert it for you.

Lazy Load for Images

For those of you who have gone to through some photo blogs and wondered how they got the images to load as you scroll.  At first I thought it was some ajax event where it would fetch the photo as you scroll but it's even easier than that.  Lazy Load event with the use of JQuery plug-in.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script src="/javascripts/jquery.lazyload.js" type="text/javascript"></script>

<script type="text/javascript" charset="utf-8">

$(function() {

$("img").lazyload({placeholder : "/img/grey.gif"});

});

</script>

Here is what you need to do step by step with the help of WordPress or text editor.

  1. In WordPress to go Appearance, and click on the Editor link

  2. On the theme file listing on the right of screen select Header (header.php)

  3. Copy the above code and paste it into the header file within the <header> </header> tag, e.g. paste it below the <link rel="stylesheet" src="..." /> tag is what I did for mine.

  4. Download the JQuery.Lazyload.js file from here or here. Upload it to your website.

  5. Change the src of where your JQuery.Lazyload.js is located above. this is what mine looks like
    <script src="http://blog.tnguyen.com/wp-content/plugins/jquery-image-lazy-loading/javascripts/jquery.lazyload.js" type="text/javascript"></script>


  6. That should be it when you are done this is what it should look like in your header.php file
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

    <head profile="http://gmpg.org/xfn/11">

    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>

    <script src="http://blog.tnguyen.com/wp-content/plugins/jquery-image-lazy-loading/javascripts/jquery.lazyload.js" type="text/javascript"></script>

    <script type="text/javascript" charset="utf-8">

    $(function() {

    $("img").lazyload({placeholder : "http://blog.tnguyen.com/wp-content/plugins/jquery-image-lazy-loading/img/grey.gif"});

    });

    </script>
    </head>


  7. Hit the "Update File" button and check out your website to see if Lazy Load is not working

  8. If nothing works comment below.


The reason why I'm blogging about this is that it took me a few days to figure this out.  With so many people using this lazy load method very few website showed how to get it work properly.  I had a WordPress Plug-in that does this but it did not work for me.  There were so many reasons but I surmise it had something to do with the JQuery file itself.  This is one method that I've found to work for me.

To give credit where credit is due the main source of all of this came from Mika Tuupola.

Saturday, March 13, 2010

Wordpress Aligncenter

I've been trying to update my other blog  - Through the Eye Piece - and for a while I've been running into issues aligning my images to center them.  I was using an old theme that I've tweaked to layout the way I wanted but with so many CSS changes I never got around to fixing my image alignment until now.  With the help of Firefox plugin called Firebug, I was able to track down the align class that wordpress assigned to the image and then checked my CSS to see if it's there.  Firebug with it's grace and awesome functionality showed me that I had no aligncenter CSS associated with this image.  I googled search and found the following CSS post on Wordpress Codex that resolved the problem.  Since this was an old wordpress theme some CSS was missing but luckily it was an easy fix.  It also incidentally resolved another quirk I was running into, the caption for the images was not showing up.

To make it easier for everyone you can just past the following into your stylesheet and it should resolve your alignment issue along with your caption issue too.
.aligncenter,
div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

.alignleft {
float: left;
}

.alignright {
float: right;
}

.wp-caption {
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
margin: 10px;
/* optional rounded corners for browsers that support it */
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}

.wp-caption img {
margin: 0;
padding: 0;
border: 0 none;
}

.wp-caption p.wp-caption-text {
font-size: 11px;
line-height: 17px;
padding: 0 4px 5px;
margin: 0;
}

Now the next problem to battle, lazy load my long image posts.