FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Use getimagesize on an attached file from postproc.inc.t
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Use getimagesize on an attached file from postproc.inc.t [message #162724] Thu, 08 July 2010 11:00 Go to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
I have this code:

<?php
case 'img':
case 
'imgl':
case 
'imgr':
if (!
$allow_img) {
$ostr .= substr($str$pos, ($cepos-$pos)+1);
} else {
$class = ($tag == 'img') ? '' 'class="'.$tag{3}.'" ';
$img_maxwidth 600;

if (!
$parms) {
$parms substr($str$epos+1, ($cpos-$epos)-1);
list(
$imgw$imgh) = getimagesize(url_check($parms));
if (
$imgw $img_maxwidth) {
$img_ratio $imgw/$img_maxwidth;
$imgw $img_maxwidth;
$imgh round($imgh/$img_ratio);
}

if (
strpos(strtolower(url_check($parms)), 'javascript:') === false) {
if (
$img_ratio <= 1)
$ostr .= '<img '.$class.'src="'.$parms.'" style="width:'.$imgw.'px; height:'.$imgh.'px;" border="0" alt="'.$parms.'">';
else
$ostr .= '<img alt="Click to view full-size" '.$class.'src="'.$parms.'" onclick="return hs.expand(this, {allowSizeReduction: false, src: this.src})"  class="highslide" style="width:'.$imgw.'px; height:'.$imgh.'px;" border="0">'
 else
$ostr .= '<img alt="Click to view full-size" '.$class.'src="'.$parms.'" onclick="return hs.expand(this, {allowSizeReduction: false, src: this.src})"  class="highslide" style="width:'.$imgw.'px; height:'.$imgh.'px;" border="0">';
} else {
$ostr .= substr($str$pos, ($cepos-$pos)+1);
}
} else {
if (
strpos(strtolower(url_check($parms)), 'javascript:') === false) {
list(
$imgw$imgh) = getimagesize(url_check($parms));
if (
$imgw $img_maxwidth) {
$img_ratio $imgw/$img_maxwidth;
$imgw $img_maxwidth;
$imgh round($imgh/$img_ratio);
}
if (
$img_ratio <= 1)
$ostr .= '<img '.$class.'src="'.$parms.'" style="width:'.$imgw.'px; height:'.$imgh.'px;" border="0" alt="'.substr($str$epos+1, ($cpos-$epos)-1).'">';
else
$ostr .= '<img alt="Click to view full-size" '.$class.'src="'.$parms.'" onclick="return hs.expand(this, {allowSizeReduction: false, src: this.src})"  class="highslide" style="width:'.$imgw.'px; height:'.$imgh.'px;" border="0">';
} else {
$ostr .= substr($str$pos, ($cepos-$pos)+1);
}
}
}
$epos $cepos;
$str[$cpos] = '<';
break;
?>




The code works on regular images, however, when the image inside the tags is an attachment, IE index.php?getfile=123&private=0 it doesn't work.

I tried to write the script in a separate PHP file to see if perhaps it didnt work with getimagesize() on a dynamic php file, but it works just perfect.

So, my conclusion is that somehow the getfile.php script isnt executed when running post_proc for some reason and I would love to know how I can take care of this!


I could walk around this and create a new BB code tag that allows me to specify img dimensions, but that feels unecessary!

So, any help provided is appreciated!


[Updated on: Thu, 08 July 2010 11:02]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mailing list integration
Next Topic: Removing disclaimers from mailing list synced postings
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 12:37:53 GMT 2024

Total time taken to generate the page: 0.05076 seconds