2

When linking to a resized image by PHPThumb to popup in a lightbox using either thickbox or colorbox, I am getting a lightbox come up with data and characters. I am guessing because thickbox does not see my image as a real image because it is outputted with the php extension:

includes/phpThumb/phpThumb.php?src=includes/kcfinder/upload/files/1209679628284.jpg&w=800&h=600&zc=1

Anybody know a solution?

Also, is using PHPThumb for a content management system a good idea? Would just resizing the image to multiple sizes work better on more setups/server configs?

LINK: http://jeffkilroy.com/hosted/ImageIssue/test.php

kilrizzy
  • 2,895
  • 6
  • 40
  • 63
  • An image is an image, whether created with PHP or not. Can you show your code? – Pekka Aug 09 '10 at 20:06
  • Added a link, thanks for taking a look! – kilrizzy Aug 09 '10 at 20:57
  • which one of the three images is not working? For the second one, I get a 404 not found. – Pekka Aug 09 '10 at 21:01
  • Yes the second isn't coming up for some reason, but click the first and last, the lightbox is bringing up the characters as if it is attempting to view the picture as an html page – kilrizzy Aug 10 '10 at 13:10

2 Answers2

2

Fixed it.

Thickbox (and I'm sure colorbox as well) gets the file extension:

 var urlString = /\.jpg$|\.php$|\.jpeg$|\.png$|\.gif$|\.bmp$/;

added .php in there as well as the following if statement:

if(urlType == '.php' ||urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){

And it works!

kilrizzy
  • 2,895
  • 6
  • 40
  • 63
  • just in case this helps anyone out: for nyroModal, since the regex looks for the extension (jpg, png, etc) at the end of the href, there's no use adding "php" to the list of extensions since calling phpThumb doesn't end in "php" but instead its parameters. So to make this work in nyroModal, simply append ".jpg" or any other extension to the href, after calling phpThumb. For example `phpThumb.php?src=photo.jpg&q=90&w=100&h=100.jpg` As long as it ends in an extension that nyroModal recognizes, it will work – Obay Feb 21 '12 at 03:28
0

Colorbox has a setting; photo: false by default.

If true, this setting forces ColorBox to display a link as a photo. Use this when automatic photo detection fails (such as using a url like 'photo.php' instead of 'photo.jpg')

So something like this should work:

$("a.gallery").colorbox({photo: true});
Dale
  • 2,125
  • 2
  • 16
  • 18