PDA

View Full Version : Warning Messages (more)


Abronsyth
09-30-2014, 03:19 PM
I've gone through all of the threads involving warning images above the header, but could find any solutions to this.

I'm getting these errors just about everywhere:
Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/class_image.php on line 114

Here is what I believe to be the problem in the file classes/class_image.php:
public function setSrc(URL $src){
$this->src = $src;
list($this->width, $this->height) = getimagesize($src->getURL());
$this->setAttributes("Src");

And here is the whole file, just in case:
<?php

/**
* The Image Class, extends from abstract GUIAccessory class.
* It defines a standard image element to be used in HTML.
* @category Resource
* @package GUI
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/

class Image extends GUIAccessory implements Resizable{

/**
* The alt property, defines the alt text for image object.
* @access protected
* @var String
*/
protected $alt;

/**
* The src property, stores the src of this image object.
* @access protected
* @var Link
*/
protected $src;

/**
* The width property, specifies the width of this image.
* @access protected
* @var Int
*/
protected $width;

/**
* The height property, specifies the height for this image.
* @access protected
* @var Int
*/
protected $height;

/**
* The action property, it holds information for javascript actions.
* @access protected
* @var String
*/
protected $action;

/**
* The type property, determines the image type as background or else.
* @access protected
* @var String
*/
protected $type;

/**
* Constructor of Image Class, which assigns basic image properties.
* @access public
* @return Void
*/
public function __construct($src = "", $alt = "", $dimension = "", $event = ""){
parent::__construct($alt);
$src = ($src instanceof URL)?$src:new URL($src);
$this->setSrc($src);
if(!empty($alt)) $this->setAlt($alt);
if(is_numeric($dimension)){
$this->setWidth($dimension);
$this->setHeight($dimension);
}
if(!empty($event)) $this->setEvent($event);
}

/**
* The getAlt method, getter method for property $alt.
* @access public
* @return String
*/
public function getAlt(){
return $this->alt;
}

/**
* The setAlt method, setter method for property $alt.
* @param String $alt
* @access public
* @return Void
*/
public function setAlt($alt){
$this->alt = $alt;
$this->setAttributes("Alt");
}

/**
* The getSrc method, getter method for property $src.
* @access public
* @return URL
*/
public function getSrc(){
return $this->src;
}

/**
* The setSrc method, setter method for property $src.
* @param URL $src
* @access public
* @return Void
*/
public function setSrc(URL $src){
$this->src = $src;
list($this->width, $this->height) = getimagesize($src->getURL());
$this->setAttributes("Src");
}

/**
* The getWidth method, getter method for property $width.
* @access public
* @return Int
*/
public function getWidth(){
return $this->width;
}

/**
* The setWidth method, setter method for property $width.
* @param Int $width
* @access public
* @return Void
*/
public function setWidth($width = 40){
$this->width = $width;
$this->setAttributes("Width");
}


/**
* The getHeight method, getter method for property $height.
* @access public
* @return Int
*/
public function getHeight(){
return $this->height;
}

/**
* The setHeight method, setter method for property $height.
* @param Int $height
* @access public
* @return Void
*/
public function setHeight($height = 40){
$this->height = $height;
$this->setAttributes("Height");
}

/**
* The resize method, resizes the width and height simultaneous while keeping aspect ratio.
* @param Int $dimension
* @param Boolean $percent
* @access public
* @return Void
*/
public function resize($dimension, $percent = FALSE){
if($percent){
$this->width *= $dimension;
$this->height *= $dimension;
}
else{
$this->width = $dimension;
$this->height = $dimension;
}
$this->setAttributes("Width");
$this->setAttributes("Height");
}

/**
* The getAction method, getter method for property $action.
* @access public
* @return String
*/
public function getAction(){
return $this->action;
}

/**
* The setAction method, setter method for property $action.
* @param String $action
* @access public
* @return Void
*/
public function setAction($action){
$this->action = $action;
$this->setAttributes("Action");
}

/**
* The getType method, getter method for property $type.
* @access public
* @return String
*/
public function getType(){
return $this->type;
}

/**
* The setType method, setter method for property $type.
* @param String $type
* @access public
* @return Void
*/
public function setType($type){
$this->type = $type;
}

/**
* The render method for Image class, it renders image data fields into HTML readable format.
* @access public
* @return String
*/
public function render(){
if($this->renderer->getStatus() == "ready"){
if($this->type == "Background"){
$this->renderer->renderBackground();
}
else{
$this->renderer->start();
parent::render()->pause();
}
}
return $this->renderer->getRender();
}

/**
* Magic method __toString for Image class, it reveals that the object is an image.
* @access public
* @return String
*/
public function __toString(){
return "This is an instance of Mysidia Image class.";
}
}
?>

Does someone see the error, here?


ERROR TWO:
And now I get this when trying to see /adopt on the site:
Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/class_image.php on line 114 Warning: getimagesize(http://ferrepets.com/templates/icons/default_avatar.gif): failed to open stream: no suitable wrapper could be found in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/class_image.php on line 114 Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/view/adoptview.php on line 61 and the rest is a blank white screen :/

My adoptview.php:
<?php

class AdoptView extends View{

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;

if($mysidia->input->post("submit")){
$aid = $this->getField("aid")->getValue();
$name = $this->getField("name")->getValue();
$eggImage = $this->getField("eggImage")->getValue();
$image = new Image($eggImage);
$image->setLineBreak(TRUE);

$document->setTitle("{$name} adopted successfully");
$document->add($image);
$document->addLangvar("Congratulations! You just adopted {$name}. You can now manage {$name} on the ");
$document->add(new Link("myadopts", "Myadopts Page."));
$document->add(new Comment(""));
$document->add(new Link("myadopts/manage/{$aid}", "Click Here to Manage {$name}"));
$document->add(new Comment(""));
$document->add(new Link("myadopts/bbcode/{$aid}", "Click Here to get BBCodes/HTML Codes for {$name}"));
$document->add(new Comment(""));
$document->addLangvar("Be sure and");
$document->add(new Link("levelup/{$aid}", "feed "));
$document->addLangvar("{$name} with clicks so that they grow!");
return;
}

$document->setTitle($mysidia->lang->title);
$document->addLangvar((!$mysidia->user->isloggedin)?$mysidia->lang->guest:$mysidia->lang->member);
$adoptForm = new Form("form", "adopt", "post");
$adoptTitle = new Comment("Available Adoptables");
$adoptTitle->setHeading(3);
$adoptForm->add($adoptTitle);
$adoptTable = new Table("table", "", FALSE);

$adopts = $this->getField("adopts");
for($i = 0; $i < $adopts->length(); $i++){
$row = new TRow;
$idCell = new TCell(new RadioButton("", "id", $adopts[$i]->getID()));
$imageCell = new TCell(new Image($adopts[$i]->getEggImage(), $adopts[$i]->getType()));
$imageCell->setAlign(new Align("center"));

$row->add($idCell);
$row->add($imageCell);
$adoptTable->add($row);

$adoptForm->add($adoptTable);
$adoptSubtitle = new Comment("Adopt");
$adoptSubtitle->setHeading(3);
$adoptForm->add($adoptSubtitle);
$adoptForm->add(new Comment("Adoptable Name: ", FALSE));
$adoptForm->add(new TextField("name"));
$adoptForm->add(new Comment(""));
$adoptForm->add(new Button("Adopt Me", "submit", "submit"));
$document->add($adoptForm);
}
}
?>

Abronsyth
10-03-2014, 04:19 PM
The second error is really bad- I can't get onto my /adopt page now because of it :/

Abronsyth
10-04-2014, 10:36 AM
Okay, managed to get rid of that /adopt page issue on my own.

Now I'm just having serious issues with the warning, I believe it is also preventing the URL codes from working properly. The line I'm really keyed in on is this;
allow_url_fopen=0

I think if I can switch 0 to 1 it might fix the issue, but I do not know where to fix this issue, since I can't find "allow_url_fopen=0" anywhere.

IntoRain
10-04-2014, 11:38 AM
That's usually inside the php.ini I believe, some hosts don't allow different php.ini's though

Your class_adoptview.php was missing a } to close the class, did you put it back?

A warning shouldn't be causing major issues, can I see the error_log contents of the last few days?

Abronsyth
10-04-2014, 06:40 PM
Erp, not major issues, but it makes just browsing the site so annoying that it can be frustrating. Sorry ^_^'

Eeeeh I am very happy now <3 IntoRain, you have all of my love <3 I figured out how to edit the php.ini, turned "allow_url_fopen=Off" to "allow_url_fopen=On" and, voila- no more annoying errors above the header! Thank you for point me to the right place <3

And yeah, I caught that and fixed it :)

Thank you again for all of your help <3 Def. not the first time you've been just a huge help!