Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-30-2017, 03:16 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,622
Dinocanid is on a distinguished road
Default Broken siggy images

I read this thread again, but it didn't seem to fix it. Neither of the BBcodes for my pets seem to be working, and it just gives a broken image:

(forum)

(alternate)

This is what my code looks like:
PHP Code:
public function bbcode(){ 
        
$mysidia Registry::get("mysidia"); 
        
$adopt $this->getField("adopt");             
        
$document $this->document
        
$document->setTitle($this->lang->bbcode.$adopt->getName());  
        
$document->addLangvar($this->lang->bbcode_info); 
        
$document->add(new Comment("<br>")); 
         
        
$forumComment = new Comment("Forum BBCode: ");         
        
$forumComment->setUnderlined(); 
        
$forumcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img][/url]";         
        
$forumArea = new TextArea("forumcode"$forumcode450); 
        
$forumArea->setReadOnly(TRUE); 
         
        
$altComment = new Comment("Alternative BBCode: ");         
        
$altComment->setUnderlined(); 
        
$altcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif[/img][/url]"
        
$altArea = new TextArea("altcode"$altcode450); 
        
$altArea->setReadOnly(TRUE); 
         
        
$htmlComment = new Comment("HTML BBCode: ");         
        
$htmlComment->setUnderlined(); 
        
$htmlcode "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'> 
                     <img src='
{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>"
        
$htmlArea = new TextArea("htmlcode"$htmlcode450); 
        
$htmlArea->setReadOnly(TRUE); 
         
        
$document->add($forumComment); 
        
$document->add($forumArea); 
        
$document->add($altComment); 
        
$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site.")); 
        
$document->add($htmlComment); 
        
$document->add($htmlArea); 
(myadoptsview)
PHP Code:
public function siggy(){
        
$mysidia Registry::get("mysidia");
        
// The adoptable is available, let's collect its info
        
$usingimage "no";
        
$image $this->adopt->getImage(); 
      
        
$usegd $mysidia->settings->gdimages;
        
$imageinfo = @getimagesize($image);
        
$imagemime $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...

        
if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif"){
            
$usingimage "yes"//Turn the template system off
            
$type $this->adopt->getType();
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image

            // Lets create the new target image, with a size big enough for the text for the adoptable
            
$newheight $height 72;
            
$newwidth = ($newwidth 250)?250:$width;
            
$img_temp imagecreatetruecolor($newwidth$newheight); 
            
$alphablending true;  
         
            
// Lets create the image and save its transparency  
            
$img_old = @imagecreatefromgif($image);  
            
imagealphablending($img_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// Build text for siggy
            
$str1 "Name: ".$this->adopt->getName();
            
$str2 "Owner: ".$this->adopt->getOwner();
            
$str3 "Click Here to Feed Me!";
            
$str4 "More Adopts at:";
            
$str5 "www.".constant("DOMAIN");

            
// Renger Image
            
imagestring ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
ImageColorTransparent($image$background);  
 
            
// At the very last, let's clean up temporary files
            
header("Content-Type: image/GIF");
            
ImageGif ($image);
            
imagedestroy($image);
            
imagedestroy($img_temp);
            
imagedestroy($img_old);
            
imagedestroy($bgi);

        }
        elseif(
function_exists('imagepng') and $usegd == "yes" and $imagemime == "image/png"){
            
$usingimage "yes"//Turn the template system off
            
$type $this->adopt->getType();
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image

            // Lets create the new target image, with a size big enough for the text for the adoptable
            
$newheight $height 72;
            
$newwidth = ($newwidth 250)?250:$width;
            
$img_temp imagecreatetruecolor($newwidth$newheight); 
            
$alphablending true;  
         
            
// Lets create the image and save its transparency  
            
$img_old = @imagecreatefrompng($image);  
            
imagealphablending($img_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// Build text for siggy
            
$str1 "Name: ".$this->adopt->getName();
            
$str2 "Owner: ".$this->adopt->getOwner();
            
$str3 "Click Here to Feed Me!";
            
$str4 "More Adopts at:";
            
$str5 "www.".constant("DOMAIN");

            
// Renger Image
            
imagestring ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
ImageColorTransparent($image$background);  
 
            
// At the very last, let's clean up temporary files
            
header("Content-Type: image/PNG");
            
ImageGif ($image);
            
imagedestroy($image);
            
imagedestroy($img_temp);
            
imagedestroy($img_old);
            
imagedestroy($bgi);

        }
        else{      
                
// We are going to try and get this image the old fashioned way...
            
$extList = array();
            
$extList['gif'] = 'image/gif';
            
$extList['jpg'] = 'image/jpeg';
            
$extList['jpeg'] = 'image/jpeg';
            
$extList['png'] = 'image/png';

            
//Define the output file type
            
$contentType 'Content-type: '.$extList$imageinfo['extension'] ];

            if(
$imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){             
                throw new 
InvalidIDException("The file Extension is not allowed!");
            }
            else{
                
// File type is allowed, so proceed
                
$status "";
                
header($contentType);
                
$curl = new Curl($image);
                
$curl->setHeader();
                
$curl->exec();
                
$curl->close();
            } 
        }
    } 
(levelup)
__________________
Reply With Quote
  #2  
Old 06-30-2017, 09:15 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

That's curious, I compared it to mine/from my site and though they are being generated in the same format, mine is working.

So comparing my levelup.php to yours, I do see distinct differences in the siggy function. Majorly in that you have this chunk here...which does not exist at all in mine:
PHP Code:
elseif(function_exists('imagepng') and $usegd == "yes" and $imagemime == "image/png"){ 
            
$usingimage "yes"//Turn the template system off 
            
$type $this->adopt->getType(); 
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image 

            // Lets create the new target image, with a size big enough for the text for the adoptable 
            
$newheight $height 72
            
$newwidth = ($newwidth 250)?250:$width
            
$img_temp imagecreatetruecolor($newwidth$newheight);  
            
$alphablending true;   
          
            
// Lets create the image and save its transparency   
            
$img_old = @imagecreatefrompng($image);   
            
imagealphablending($img_oldtrue);   
            
imagesavealpha($img_oldtrue); 
    
            
// Lets copy the old image into the new image with   
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);     
            
$textheight $width 2
            
$image $img_temp
            
$bgi imagecreatetruecolor($newwidth$newheight); 
            
$color imagecolorallocate($bgi515151); 
          
            
// Build text for siggy 
            
$str1 "Name: ".$this->adopt->getName(); 
            
$str2 "Owner: ".$this->adopt->getOwner(); 
            
$str3 "Click Here to Feed Me!"
            
$str4 "More Adopts at:"
            
$str5 "www.".constant("DOMAIN"); 

            
// Renger Image 
            
imagestring ($image120$textheight,  $str1$color); 
            
imagestring ($image120$textheight 13,  $str2$color); 
            
imagestring ($image120$textheight 26,  $str3$color); 
            
imagestring ($image120$textheight 42,  $str4$color); 
            
imagestring ($image120$textheight 55,  $str5$color); 
            
$background imagecolorallocate($image000);   
            
ImageColorTransparent($image$background);   
  
            
// At the very last, let's clean up temporary files 
            
header("Content-Type: image/PNG"); 
            
ImageGif ($image); 
            
imagedestroy($image); 
            
imagedestroy($img_temp); 
            
imagedestroy($img_old); 
            
imagedestroy($bgi); 

        } 
Aside from that everything else is the same...so maybe something to do with that?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #3  
Old 06-30-2017, 09:18 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,622
Dinocanid is on a distinguished road
Default

That's the png image mod, I added it recently to see if it would fix the problem; it didn't though
__________________
Reply With Quote
  #4  
Old 06-30-2017, 10:07 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

Okay, I just found the tiniest discrepancy that makes a big difference!!

In your myadoptsview file find this line;
PHP Code:
$altcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif[/img][/url]"
Replace it with this:
PHP Code:
$altcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif\"[/img][/url]"
Let me know if that works
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #5  
Old 06-30-2017, 10:12 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,622
Dinocanid is on a distinguished road
Default

That didn't work either.
__________________
Reply With Quote
  #6  
Old 06-30-2017, 10:16 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

Huh, those were the only two differences I could find. I'll try replacing my functions with yours and see if it breaks my images, if not then chances are it is an issue in another file.

Edit: Oh, and do you have a closing bracket for the bbcode function for myadoptsview.php? It's not included in what you pasted, but I assumed you just didn't paste it.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #7  
Old 06-30-2017, 10:24 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,622
Dinocanid is on a distinguished road
Default

Yeah it's there, I just didn't paste it. I can't think of another file that would be causing it, unless bbcodes are handled elsewhere too.
__________________
Reply With Quote
  #8  
Old 07-01-2017, 09:07 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

Okay, so I tested your script with my site, both each individually (only the levelup, only the myadoptsview) and together, but my images work in each case.

Now when I take my ../levelup/siggy/{$aid} and put it in my URL bar it shows me the image. However, when I take yours;
http://adopttest.mysidiahost.com/levelup/siggy/2107

I get this mess...
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/adopttes/public_html/levelup.php:34) in /home/adopttes/public_html/levelup.php on line 197
GIF89a���T�L��t,B$l�d�����Db$t�td�\$64N,T~LT�T��|,F,��Č�|�Ƅ|�tDnD��|�ޔl�\d�\d�\4F,t�l�����424��|��l�d���t�l&�֌4V4���l�d|�t�֜��.�΄$>$���t�l��TvLl�lT�T��|,B,DbDLrL\�\���l�lDjD,d�d$6$4N4T~T����ƌ|�|���l�dd�d4F4�����!��,����	H����	�"ŠA" ���ŋ3j�ȱ�Ǐ Cfl�pP d.���dƅ G��I��$C�$Ȇ�$H"� J��ѣ1����?	�5�Úp z ���PW�W�<���I�l0�8 �@Xܴel�XV�Z�h i$��&�P	���I���lH�	��p30d�� z!�5@�h��*Y,	�!	2� ����4P	��	P� �F}>���$��pl�6i��.�lZ�kP\�`sa&c�ve& DHzϰ��8	�(�P�p�Y��<і zְl����M�����e�bi4P .0���_Q�y���i2&���idw�x��g�)��i�Y�j�#�������pS�R�yoxQ���Y��f�Z��Vp��v�P�ވs��p�U�}pGz�G����8�I�bpbp�f����p@�ח��g��9���>�X� �af3f��) d 0z�yz���X�!����	�8��Ԡ�1! @ڍ`��p}H�ꡗ����QP\�'�``�3 c��}�I���G�/z�����I�6��7ʠ<��dP��ЀB:��G�_����XQ�?H�tЀbv���y�I��\��j`�{��0:Вez�6�7�L�,k�)�P�3�q �8��u��X�B�k�P���w�xX����pzz��������0�5z��*�P��ٶ�;�,��4V����r #J�@J�Xj�e�voG������.�9�ә�������_�,�����I����	%�W�#:���t��3Pm����v�X�t�Ι��������j��:�P��j#jJ�3G� z�y9����Tm:p	:@p��������+Z�zЊ����p����:�	� ��8 ��*����&� ��``Ơ-��вZۑ@f��iXkm�����+�;��	���� ���W0�b�g��N� 8�b�;*���C�P0�00A �Y ������v�����(w�(z��0�$i�?�	��P+9-ْ�P�&� �`���6j����?�sʐ�����������}o[zz�8��7H�&�z5�f��ΰ�� ��Wp`�k��{���ͅ ū�6����K��q����1q?�����f0	=��.���+��;������K����Ú�2��0 s����r7w_��G�<��k��51�{�d��̱N������@�_�;`��2��.���(~H���I�G���{��p7ڱ:�������ڦ.@�;>p���:�A��I��	�*i�E���Z�Ȁ�hʴ]��_|�=,�7��#i#�>�ƶ��5��I�L�Kxɰ��Ы5l�z���M�Pq�b ,�K������0a��p �l��������))��,i�fz���\ʖz�8Ka�ʜ �-az˛P5�A����5`�<��H��ɗ�����*��˖��S�#�!)���1�e	�+ٙ���[ß|�˴O��_��Ê���/�,�?:6CP�9��۫-��i����5���J�����|�_�@-�� &�� ����!P��|�O�΀�Ģ���.}#<��0,!�7�����Z��]��슸��6B�E�#!�N�ԁ��;}��å촖�˼Š&�]=:L��\�3 ��<����P��,�R�+M\=�s&�B�zz�6z�;�%m��k�P� -��9��,m��m�8��J�M,��n�ٞ�ى�ʲ#6�l�5�_���6��ٰ�Q����k�)���q���m�-������]��}�؝�ڽ����������=��]��}��������������=��]��}�������������� �@�>�	��>��������� ��n�� ���������P�>�^^��!�����4N�.��&�s��,��/��3��~���.�B��J�I��>~�����R>�V�F~�+nT��K����.�HN�]>�)^Yn�N��h^�U��[� a��pN�Aq��_��k>w~���>N�"��%.5��u~�X���ㇾ�5��A�b^�[n�n�D��in�	��~�蜞�~�xnߡ������8��*�鷑��z�>�^��붞�s�뎮3�>t���1.�9�>�P����.�I�0��ޖ�.�^�G��E^�x�J��n��M~�����z.�l���n�~�.��^������Z��YN�Ǯ��~��N�.�������������������_���h������)��N������ �����2Y�|�P�~�^�A�_�;������� ��K�N���=�~�^��n)#o��W��Z����o���n��o�N揞#�.�a��h�B��R��N�Ӯ�<��^_�E/㢮�@��zO����1��O�i� ���i魞��陏�ڮ�_�%�l���?� 2�����+��&��f����|�$�������7�����v����������r�>��o��������?�ۮ��n������������A�n����a��n�)?��O��������/�Ȓ���h��m�$�p�B�  L����#R���ĉ3n���F�$G"d���D�'?��S�L�5m�ęS�N�=}�T�P�E�E�T�R�M�>�U�T�U�^ŚU�V�]��L�4�ñ^͞���ҍ/��|4.Z��;
Warning: imagedestroy(): 108 is not a valid Image resource in /home/adopttes/public_html/levelup.php on line 200

Fatal error: Uncaught exception 'GUIException' with message 'This document has no title yet.' in /home/adopttes/public_html/classes/class_document.php:52 Stack trace: #0 /home/adopttes/public_html/classes/class_frame.php(217): Document->getTitle() #1 /home/adopttes/public_html/classes/class_template.php(161): Frame->render() #2 /home/adopttes/public_html/classes/class_view.php(279): Template->render() #3 /home/adopttes/public_html/classes/class_frontcontroller.php(102): View->render() #4 /home/adopttes/public_html/index.php(75): FrontController->render() #5 /home/adopttes/public_html/index.php(79): IndexController::main() #6 {main} thrown in /home/adopttes/public_html/classes/class_document.php on line 52
It's complaining an awful lot in there.

It would seem like it is finding an error somewhere in the levelup file, but as I said it worked for me just fine so I would imagine it is running into trouble either outside of the siggy function in the levelup file, or in a different file altogether.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #9  
Old 07-01-2017, 11:32 AM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,622
Dinocanid is on a distinguished road
Default

Ok so I replaced my entire levelup file with a fresh one and the forum codes seem to be working now (alternate code still looks broken though, does this board allow it?)
I'll update if I find out what broke it when I add back my changes one at a time.
EDIT: Ok so here I was using style tags inside the file That seemed to be the problem.
__________________

Last edited by Dinocanid; 07-01-2017 at 11:37 AM.
Reply With Quote
  #10  
Old 07-06-2017, 08:20 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,399
Hall of Famer is on a distinguished road
Default

So your issue is resolved?
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:51 AM.

Currently Active Users: 447 (0 members and 447 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636