
PHP: Display Adobe PSD files on a web page
Any webdesigner know the PSD filetype, which is the Adobe Photoshop format. PSDs have a lot of great features, as such as layers, but they can’t being read by a browser. Unless you use this great PHP class!
The classPhpPsdReader.php Class
The classPhpPsdReader.php Class was created by Tim de Koning in 2007. It is based on the GD library, which can do numerous operations on images with PHP, but sadly, can’t open PSD files.
The classPhpPsdReader.php Class can be downloaded for free on PhpClasses.org. It is compatible with both PHP4 and PHP5.
Usage
Nothing hard here. Once you have downloaded the classPhpPsdReader.php class and uploaded it on your server, you’re now ready to display PSD throught a web browser.
To do so, just refer to the following code example:
<?php
// Send header to client browser
header("Content-type: image/jpeg");
// Includes the requested class
include_once('classPhpPsdReader.php');
// Finally display the PSD on the screen
imagejpeg(imagecreatefrompsd('yourPsdFile.psd'));
?>The result

Great tool for people who are, like me, both webdevelopers and webdesigners!
On another note, I just purchased a new blog to complete my network. The blog is called PsdVibe and you can have a look here. The blog focus on providing Adobe Photoshop tutorials, resources and freebies.




32 Comments + Trackbacks
6.1.2009
To be honest I didn’t expect this kind of tool to exist, heck I’m going to try it tomorrow to see how it goes.
6.1.2009
Didn’t know php was able to do that! Thanks!
6.2.2009
PSD files are huge. This might be a nice idea for smaller files but I had projects as big as 10-20 mb. I wouldn’t like to display that on a page and make people load for like 10 minutes.
6.2.2009
I don’t know much about web designs… but anyway I enjoyed reading it.
6.2.2009
Thanks for the information…
6.2.2009
Well, i hear for first time for such a code. It is really interesting, and i am surely that it has some use for web designs or some other purposes.
Anyway, congrats on the psd site purchase. If i am not wrong that is second site about photoshop tutorials that you own ? The first one is psdrecipes..
6.2.2009
@Catrin W: Yes, I already have psdrecipes.com, which focus on short/useful Photoshop recipes
6.3.2009
That’s a very awesome tool!!
6.7.2009
I could never know that it is even possible to embed psd directly in the post. I published a few posts on the topic but I have to use screen capture shots for that. Thanks for sharing an amazing resource.
6.8.2009
Oh wow amazing.. where did you discover this trick? lol
6.8.2009
Thanks, good stuff!
6.10.2009
If you made an artwork with Adobe Photoshop Elements(3.0),can you open the file and/or edit it with other Adobe Photoshops like CS3 and/or CS3..?If not,what are the exceptions?
6.12.2009
@Free web page design, I think everything is being installed with installation of Adobe CS3(I am talking about extensions etc) so you would haven’t any problems in doing that.
6.17.2009
Superb tutroial, I never thought you could do that with pdf and php together
6.18.2009
That’s awesome! As someone who designs webpages and custom graphics, this is something I’ve always needed and never knew it.
6.20.2009
I didnt know you could even access or display psd files without using photoshop yet alone via a php page
6.20.2009
Brilliant! thanks for the demo. This will really improve my website
6.20.2009
I had not known anything about PSD reader!
easy example. Does it work for all browsers?
Thanks a lot. will test it…
6.30.2009
Thanks ! Nice to know that this tool is around.
7.2.2009
Great post. PHP never fails to amaze!
7.6.2009
What is the point of doing this? Why would we want to show PSD files directly?
7.28.2009
Sometimes I send my psd sketches to the clients and they don’t have photoshop installed, nice decision in such cases, thanks Jean !
7.31.2009
This is not something i would of immediately thought of but i can definately see its uses.