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

Reading psd files with php
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.

Related Posts

No related posts.
 

23 Comments

  1. Posted June 1, 2009 at 5:21 am | Permalink

    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.

  2. Heenok
    Posted June 1, 2009 at 7:36 pm | Permalink

    Didn’t know php was able to do that! Thanks!

  3. Posted June 2, 2009 at 10:30 am | Permalink

    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.

  4. Posted June 2, 2009 at 11:24 am | Permalink

    I don’t know much about web designs… but anyway I enjoyed reading it.

  5. Posted June 2, 2009 at 11:50 am | Permalink

    Thanks for the information…

  6. Posted June 2, 2009 at 9:44 pm | Permalink

    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..

  7. Posted June 2, 2009 at 10:59 pm | Permalink

    @Catrin W: Yes, I already have psdrecipes.com, which focus on short/useful Photoshop recipes :)

  8. Posted June 3, 2009 at 3:37 am | Permalink

    That’s a very awesome tool!!

  9. Posted June 7, 2009 at 1:30 pm | Permalink

    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.

  10. Posted June 8, 2009 at 7:23 am | Permalink

    Oh wow amazing.. where did you discover this trick? lol

  11. Posted June 8, 2009 at 8:05 pm | Permalink

    Thanks, good stuff!

  12. Posted June 10, 2009 at 4:03 pm | Permalink

    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?

  13. Posted June 12, 2009 at 8:36 am | Permalink

    @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.

  14. Posted June 17, 2009 at 4:21 pm | Permalink

    Superb tutroial, I never thought you could do that with pdf and php together

  15. Posted June 18, 2009 at 11:48 pm | Permalink

    That’s awesome! As someone who designs webpages and custom graphics, this is something I’ve always needed and never knew it.

  16. Posted June 20, 2009 at 10:49 am | Permalink

    I didnt know you could even access or display psd files without using photoshop yet alone via a php page

  17. Posted June 20, 2009 at 11:27 am | Permalink

    Brilliant! thanks for the demo. This will really improve my website

  18. Posted June 20, 2009 at 4:56 pm | Permalink

    I had not known anything about PSD reader!

    easy example. Does it work for all browsers?

    Thanks a lot. will test it…

  19. Posted June 30, 2009 at 9:19 pm | Permalink

    Thanks ! Nice to know that this tool is around.

  20. Posted July 2, 2009 at 4:57 pm | Permalink

    Great post. PHP never fails to amaze!

  21. Posted July 6, 2009 at 12:52 pm | Permalink

    What is the point of doing this? Why would we want to show PSD files directly?

  22. Posted July 28, 2009 at 3:18 pm | Permalink

    Sometimes I send my psd sketches to the clients and they don’t have photoshop installed, nice decision in such cases, thanks Jean !

  23. Posted July 31, 2009 at 10:35 pm | Permalink

    This is not something i would of immediately thought of but i can definately see its uses.

9 Trackbacks

  1. By PHP: Display Adobe PSD files on a web page on June 1, 2009 at 12:00 am

    [...] more: PHP: Display Adobe PSD files on a web page Share and [...]

  2. [...] PHP: Display Adobe PSD files on a web page. Share and [...]

  3. [...] 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!" [...]

  4. [...] <?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’)); ?> Написал кот, который кодит [...]

  5. [...] PHPでPhotoshopのPSDファイルを画像に変換してブラウザに出力。 http://www.catswhocode.com/blog/php-display-adobe-psd- files-on-a-web-page [...]

  6. By diggita.it on June 20, 2009 at 7:16 pm

    PHP: Mostrare file photoshop in una pagina web…

    Fin’ora eravate abituati con le gif, jpeg o al massimo png, ma se volete potete usare direttamente i vostri capolavori fatti con photoshop nelle vostre pagine web dinamiche, grazie alla magia delle funzioni del php, il linguaggio open source, che oram…

  7. By Links for the day | CssGalleries on June 24, 2009 at 8:48 pm

    [...] PHP: Display Adobe PSD files on a web page [...]

  8. [...] [本家:http://www.catswhocode.com/blog/php-display-adobe-psd-files-on-a-web-page] [...]

  9. By 10+ extremely useful PHP classes on September 24, 2009 at 3:43 pm

    [...] few weeks ago, I wrote an article about this PHP which allow you to display any Adobe PSD file on screen. Very usefull to create [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Smashing Network
WordPress Appliance - Powered by TurnKey Linux