{"id":156,"date":"2007-05-11T14:47:05","date_gmt":"2007-05-11T13:47:05","guid":{"rendered":"http:\/\/www.nivas.hr\/blog\/2007\/05\/11\/thickbox-and-pictures-that-are-handled-dynamically-via-server-side-code\/"},"modified":"2007-05-11T15:25:30","modified_gmt":"2007-05-11T14:25:30","slug":"thickbox-and-pictures-that-are-handled-dynamically-via-server-side-code","status":"publish","type":"post","link":"https:\/\/www.nivas.hr\/blog\/2007\/05\/11\/thickbox-and-pictures-that-are-handled-dynamically-via-server-side-code\/","title":{"rendered":"ThickBox and pictures that are handled dynamically via server side code"},"content":{"rendered":"<p>After initial <a href=\"http:\/\/www.nivas.hr\/blog\/2007\/04\/27\/operation-aborted-in-ie-with-jquery-and-swfobject\/\">swfObject madness<\/a> , I really started to like <a href=\"http:\/\/www.jquery.com\/\">jQuery<\/a>. <a href=\"http:\/\/codylindley.com\">Cody Lindley<\/a> wrote ultimate hybrid modal window plugin called <a href=\"http:\/\/jquery.com\/demo\/thickbox\/\">ThickBox<\/a>.  Today, however, I encountered little problem with ThickBox. ThickBox checks a href tag for class called thickbox. If that classname is found, script checks for href filename extension and if it is one of known image formats, it shows picture as a picture. If not, it shows content as a plain text. <\/p>\n<p>I wanted to use it on a pictures that are handled dynamically via server side code. I inserted simple param check, to be able to force file extension.<\/p>\n<p>[ftf]<br \/>\n<!-- add this after the line 60 in thickbox.js --><br \/>\n\t\tvar queryString = url.replace(\/^[^\\?]+\\??\/,&#8221;);<br \/>\n\t\tvar params = tb_parseQuery( queryString );<br \/>\n\t\tif (params[&#8216;forceExtension&#8217;] != &#8221;) {<br \/>\n\t\t\turlType = params[&#8216;forceExtension&#8217;];<br \/>\n\t\t}<\/p>\n<p><!-- example usage from html --><br \/>\n<a href=\"somescript?vars=image\/34\/original\/?bla=true&amp;forceExtension=.jpg\" class=\"thickbox\" title=\"caption\"><img src=\"somescript.php?vars=image\/34\/thumb\/\" alt=\"\" name=\"picture\" id=\"picture\" border=\"0\" \/><\/a><\/p>\n<p><!-- default usage --><br \/>\n<a href=\"images\/single.jpg\" title=\"add a caption to title attribute \/ or leave blank\" class=\"thickbox\"><img src=\"images\/single_t.jpg\" alt=\"Single Image\"\/><\/a><br \/>\n[\/ftf]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After initial swfObject madness , I really started to like jQuery. Cody Lindley wrote ultimate hybrid modal window plugin called ThickBox. Today, however, I encountered little problem with ThickBox. ThickBox checks a href tag for class called thickbox. If that classname is found, script checks for href filename extension and if it is one of&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/156"}],"collection":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":0,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}