PHP - Load Imagick
Hi....
I'm trying to dive into imagick. But I cant seem to load it. My web host has Imagic 6.3.X installed but from phpinfo() it does not show, and my scripts bring fatal error. Code: [Select] Fatal error: Class 'Imagick' not found in...I have made my own php.ini and it lodes fine with .htaccess. Code: [Select] <IfModule mod_suphp.c> suPHP_ConfigPath /home/2/f/fesan/ </IfModule> In php.ini i have added: Code: [Select] ;My Extesions: [Imagick] extension=imagick.so Does anyone know how to load imagick correctly to php? I'm on a linux server. Similar Tutorialsso i wanted to create an imagick application that compared 2 images to each other and if they in anyway shape or form matched one another to output every URL it matched. however the problem i am having is appearantly the newer versions of imAgick does not support imagick_isimagesequal function. how would i get around this? anyone know? or could provide an alt solution with the PHP image function library. Hi There, I have ported my website over to another hosting provider and I cannot get this one thing working! We have images on our site, which this PHP Script should resize, but it can't find the Imagick.php script. I am convinced that it resides in a different path. Here is the error i get when trying to access one of the images : Warning: require_once(include/classes/Imagick.php) [function.require-once]: failed to open stream: No such file or directory in /hermes/bosweb/web128/b1282/ipg.accommodateruralcom/include/global.php on line 29 Fatal error: require_once() [function.require]: Failed opening required 'include/classes/Imagick.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php:/home/users/web/b1282/ipg.accommodateruralcom') in /hermes/bosweb/web128/b1282/ipg.accommodateruralcom/include/global.php on line 29 I contacted my hosting support about that and they said that the Imagick.php resides in the following directory : /usr/local/lib/ImageMagick I can appreciate that there may be references to this everywhere and anywhere. I have PHP files called imageResize, Global etc...just let me know which ones to post and ill do that. I really appreciate the help. [attachment deleted by admin] Hi, I am using imageMagick extension with php. The problem is that I can get it to run fine as a stand alone script: Code: [Select] <?php $im = new imagick('test.pdf[0]'); $im->setImageFormat( "jpg" ); header( "Content-Type: image/jpeg" ); $im->thumbnailImage(400, 0); echo $im; ?> however as soon as I introduce any more php/ html code or call the script from within code it fails with no error message. For example I would like to use it like this: Code: [Select] # loop through results and output in a table while ($stmt->fetch()) { $im = new imagick($file[0]); $im->setImageFormat( "jpg" ); header( "Content-Type: image/jpeg" ); $im->thumbnailImage(400, 0); echo $im; } Any clues as to why this won't work? Sam I'm having a problem and need an answer to why its happening and how to prevent it. Scenario: I begin load my home page which starts with a session_start(); .... Before it FULLY completes loading I try to navigate to another page and BOOM, that page will not load and any other page that begins with session_start(); will not load unless I close and restart the entire browser or wait about 10 minutes.... I will note my website makes ajax calls every 5 seconds or so, but I use setTimeout for them. Any help??? Thanks ahead! <?php $URL1 = file_get_contents('http://www.yahoo.com'); $URL2 = file_get_contents('http://www.google.com'); ?> How would I make PHP load URL1 and URL2 at the same time.. I would add more than 2 urls also, Im tyring to test something with my website, load up to 50 links at once, how would I do this? Thanks Hi, so....i have these 2 pages, but they don't show up in browser....can't find the error so will ask your help guys index.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("Location: admin_login.php"); exit(); } //Be sure to check that manager SESSION value is in database $managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["manager"]); //Filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["password"]); //Filter everything but numbers and letters //Run MySQL query to be sure that this person is an admin and that their password session var equals the database //Connect to the MySQL Database include("../storescripts/connect_to_mysql.php"); $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID AND username='$manager' AND password='$password' LIMIT 1"); //search user $existsCount = mysql_num_rows($sql); //count the row numbers if ($existsCount == 0){ //evaluate the count header("Location: ../index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MyOnlineStore | Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php");?> <p><br /> <br /> </p> <p> </p> <p><br /> </p> <div id="pageContent"> <div id="admin" align="left"> <h3>Hello what you want to do?</h3> <p><a href="#">Manage Inventory</a><br /> <a href="#">Manage afggagdfag</a></p> </div> </div> <?php include_once("../template_footer.php");?> </div> <p> </p> <p> </p> <p> </p> </body> </html> admin_login.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("Location: admin_login.php"); exit(); } //Be sure to check that manager SESSION value is in database $managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["manager"]); //Filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["password"]); //Filter everything but numbers and letters //Run MySQL query to be sure that this person is an admin and that their password session var equals the database //Connect to the MySQL Database include("../storescripts/connect_to_mysql.php"); $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID AND username='$manager' AND password='$password' LIMIT 1"); //search user $existsCount = mysql_num_rows($sql); //count the row numbers if ($existsCount == 0){ //evaluate the count header("Location: ../index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MyOnlineStore | Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php");?> <p><br /> <br /> </p> <p> </p> <p><br /> </p> <div id="pageContent"> <div id="admin" align="left"> <h3>Hello what you want to do?</h3> <p><a href="#">Manage Inventory</a><br /> <a href="#">Manage afggagdfag</a></p> </div> </div> <?php include_once("../template_footer.php");?> </div> <p> </p> <p> </p> <p> </p> </body> </html> This is the code im using: Code: [Select] <?php include "config.php"; if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT email FROM gusers WHERE id = $id LIMIT 1"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo "Email: " . $row['email']; } } } I am trying to get more informations than just the e-mail address, but everytime it seems to fail, i am a completly newb to php but ill try my best.... Could someone tell how this is done properly (like loading name, info, and so on from the database and showing it aswell) I have some FLV files above web root. I want to feed my flv player a php file and an ID. I need that php file to return an flv file basically. So if someone has firebug or something they wont see a video path, but instead see something like: fileserve.php?id=4679 I dont care if a logged in user go directly to that link and it prompts them with a download or whatever. I just want to avoid having a non logged in user do that. hello, i have a page that parses a string from espn and i have a style sheet that makes it refresh every 2 minutes. the thing that is buggin me is that when i load the page it loades with the last cached data so i have to wait 2 minutes for the info to update. is there any way to force the current content on load, and keep my refresh every 2 minutes still? thanks I'm pretty new to php. But the below script should get news articles from google news rss. It is failing to load the simplexml and returns false. Any idea why? Code: [Select] $url = "http://news.google.com/news?geo=90210"; if ($xml = @simplexml_load_file($url)) { for ($i=0; $i<4; $i++) { $item= $xml->channel->item[$i]; $link= '<a href = "'.(string) $item->link.'", target= "_blank">'.(string) substr($item->title, 0, 50).'...</a><br />'; $news[]= $link; } } Hello frnds, Im new in ur forum....I want to know that my one page is taking too much time to load....in that page no images exists..but on that page around 6000 records are loding from database....I m confuse that may be such a large records it is taking too much time...so will u help me out that what can i do so the page can be loaded quickly with these records.... this is urgent for me.....pls pls pls....give me solution soon Thnx a lot in advance I'm using this struture to run my application, everything works fine, but i don't like how the controllers are called. If i load the model in construct it will work great again, but i think that is unnecessary. You can see two pieces of code about controller "Post.php", the last one, works great. If i try this: (Posts.php) namespace app\controllers; use app\libraries\Controller; use app\models\User; class Posts extends Controller { public function index():void { //Get posts $user = new User(); $posts = $user->posts(); $data = [ 'posts' => $posts ]; $this->view('posts/index', $data); } } I will get an error: QuoteFatal error: Uncaught Error: Class 'app\models\User' not found in C:\xampp\htdocs\shake\app\controllers\Posts.php Structu Quote
- app bootstrap.php //include all files from libraries require_once __DIR__ . "/../vendor/autoload.php"; index.php use app\libraries\Core; require_once '../app/bootstrap.php'; //Init Core Library $init = new Core(); core.php public function __construct(){ $url = $this->getUrl(); //Look in controllers for first value if(file_exists(dirname(__FILE__, 2) . '/controllers/' . ucwords($url[0]) . '.php')){ //if exists, set as controller $this->currentController = ucwords($url[0]); //Unset 0 index unset($url[0]); } //Require the controller require_once dirname(__FILE__, 2) . '/controllers/' . $this->currentController . '.php'; //instantiate controller class $class = 'app\\controllers\\' . $this->currentController; $this->currentController = new $class; //check for second part of url if(isset($url[1])){ //Check to see if method exists in controller if(method_exists($this->currentController, $url[1])){ $this->currentMethod = $url[1]; //Unset 1 index unset($url[1]); } } //Get params $this->params = $url ? array_values($url) : []; //Call a callback with array of params call_user_func_array([$this->currentController, $this->currentMethod], $this->params); } Posts.php class Posts extends Controller { public function __construct() { $this->userModel = $this->model('User'); $this->postModel = $this->model('Post'); } public function index():void { //Get posts $posts = $this->userModel->posts(); $data = [ 'posts' => $posts ]; $this->view('posts/index', $data); } } Controller.php abstract class Controller { /** * Load model * @param $model * @return mixed */ public function model($model) { //Require model file require_once '../app/models/' . $model . ".php"; //instantiate model $class = 'app\models\\' . $model; return new $class(); }
Hello. If someone can help me, i'll be grateful So i have a foreach and an $output .= function that fills some infos in a table. Inside it i have a div for each line that when hovering your mouse should get some data .. Here i have a big problem, because for each line it should get some data and i don't know how to do it ... i'll post here some of my code for better understanding. Quote //some java here <?php require "class.php"; $server_list = query_group(); $misc = server_misc($server); foreach ($server_list as $server) { $misc = server_misc($server); $server = server_html($server); $idi = "{$server['o']['id']}"; $harta = "<a onmouseover=\"ShowContent('harta'); return true;\" onmouseout=\"HideContent('harta'); return true;\" href='".link($server['o']['id'])."' target=\"_self\">{$server['s']['map']}</a> <div style=\"position:absolute;\" id=\"harta\" class=\"FAQ\">file_get_contents('http://mysite/player.php?d={$idi}')</div> "; $output .= " <table> ........... some code..... <td> {$harta} </td> ....... so basicly when i hover my mouse over each row it should get data from the file for that id... The problem is that only one page can be loaded with file_get_contents. I read over the internet that some ajax functions can do it but i really don't know how. Please help me, i've been looking for 3 days already without any luck Hi everyone, I've been trying to load a remote URL using the following; Code: [Select] $url = 'http://api.ean.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=12&apiKey=2hkhej72gxyas3ky6hhjtsga&locale=en_US¤cyCode=USD&customerIpAddress=10.184.2.9&customerUserAgent=Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.25)+Gecko/20111212+Firefox/3.6.25&customerSessionId=&xml=<HotelListRequest><arrivalDate>01/22/2012</arrivalDate><departureDate>01/24/2012</departureDate><RoomGroup><Room><numberOfAdults>1</numberOfAdults><numberOfChildren>1</numberOfChildren><childAges>4</childAges></Room></RoomGroup><city>Amsterdam</city><countryCode>NL</countryCode><supplierCacheTolerance>MED</supplierCacheTolerance></HotelListRequest> '; $xml = simplexml_load_file($url); But I get met with this error; Code: [Select] Warning: simplexml_load_file() [function.simplexml-load-file]: http://api.ean.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=12&apiKey=2hkhej72gxyas3ky6hhjtsga&locale=en_US¤cyCode=USD&customerIpAddress=10.184.2.9&customerUserAgent=Mozilla/5.0%2B(Windows;%2BU;%2BWindows%2BNT%2B6.1;%2Ben-US;%2Brv:1.9.2.25)%2BGecko/20111212%2BFirefox/3.6.25&customerSessionId=&xml=%3CHotelListRequest%3E%3CarrivalDate%3E01/22/2012%3C/arrivalDate%3E%3CdepartureDate%3E01/24/2012%3C/departureDate%3E%3CRoomGroup%3E%3CRoom%3E%3CnumberOfAdults%3E1%3C/numberOfAdults%3E%3CnumberOfChildren%3E1%3C/numberOfChildren%3E%3CchildAges%3E4%3C/childAges%3E%3C/Room%3E%3C/RoomGroup%3E%3Ccity%3EAmsterdam%3C/city%3E%3CcountryCode%3ENL%3C/countryCode%3E%3CsupplierCacheTolerance%3EMED%3C/supplierCacheTolerance%3E%3C/HotelListRequest%3E%20:1: parser error : Start tag expected, '<' not found in C:\Program Files\XAMPP\xampplite\htdocs\hotel\results.php on line 29 I was told that URL I am trying to access; Code: [Select] http://api.ean.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=12&apiKey=2hkhej72gxyas3ky6hhjtsga&locale=en_US¤cyCode=USD&customerIpAddress=10.184.2.9&customerUserAgent=Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.25)+Gecko/20111212+Firefox/3.6.25&customerSessionId=&xml=<HotelListRequest><arrivalDate>01/22/2012</arrivalDate><departureDate>01/24/2012</departureDate><RoomGroup><Room><numberOfAdults>1</numberOfAdults><numberOfChildren>1</numberOfChildren><childAges>4</childAges></Room></RoomGroup><city>Amsterdam</city><countryCode>NL</countryCode><supplierCacheTolerance>MED</supplierCacheTolerance></HotelListRequest> ...is a JSON response. So I was then told to do this; Code: [Select] <?php $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $url = 'http://api.ean.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=12&apiKey=2hkhej72gxyas3ky6hhjtsga&locale=en_US¤cyCode=USD&customerIpAddress=10.184.2.9&customerSessionId=&xml=<HotelListRequest><arrivalDate>01/22/2012</arrivalDate><departureDate>01/24/2012</departureDate><RoomGroup><Room><numberOfAdults>1</numberOfAdults><numberOfChildren>1</numberOfChildren><childAges>4</childAges></Room></RoomGroup><city>Amsterdam</city><countryCode>NL</countryCode><supplierCacheTolerance>MED</supplierCacheTolerance></HotelListRequest> '; $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml); print_r($xml); ?> This then prints the array to screen. The data I am trying to access is from the Expedia Affiliate Travel Network. The URL above is from their XML Sandbox. My question is; How is the above data that gets returned a JSON response when it should be XML? and How can I access the data in the returned array without printing the array to screen? (I've tried things like echo $xml->hotelId[0] and using a foreach statement to no avail). I'm just a little confused here and have spent quite a number of hours trying to figure this out and reading other resources around the web on SimpleXML (including the PHP Manual). When working with other examples found elsewhere I seem to be ok but when dealing with this URL I seem to be out of my depth. The XML Sandbox from the EAN network is located: http://ean.mashery.com/docs/hotels/assets/XML_Sandbox The URL I am using is supposed to return a well formed XML result set. Thanks for your assistance. Bob i have a dropdown menu that displays the options i have in a database. i have this all working in mysqli as i didnt write this part on another website. but i am struggling to convert it back to mysql. the original code is: $query = "SELECT gallery_type_id, gallery_type_desc FROM gallery_type ORDER BY gallery_type_id"; /* run the query */ $result = $dbLink->query($query); /* load the query's results into an array */ $i=1; while($row=$result->fetch_assoc()){ $galleryTypes[$i] = $row; $i++; } $num_results = $result->num_rows; <select name="gallery_type" id="gallery_type"> <option>Please Select an Album <?php for($i = 1; $i < $num_results+1; $i++) { echo "<option value=\"" . $galleryTypes[$i]['gallery_type_id'] . "\">"; echo $galleryTypes[$i]['gallery_type_desc']; echo "</option>\n"; } ?> the code i have got so far: $query1 = "SELECT id, question FROM securtiyq ORDER BY id"; /* run the query */ $result= mysql_query($query1); $row = mysql_fetch_array($result); /* load the query's results into an array */ $i=1; while ($row = mysql_fetch_assoc($result)) { $galleryTypes[$i] = $row; $i++; } $num_results = mysql_num_rows($result); <select name="gallery_type" id="gallery_type"> <option>Please Select A Security Question <?php for($i = 1; $i < $num_results+1; $i++) { echo "<option value=\"" . $galleryTypes[$i]['id'] . "\">"; echo $galleryTypes[$i]['question']; echo "</option>\n"; } ?> </option> </select> the only problem is nothing from the database is displayed in the dropdown box. could someone point out where im going wrong thanks in advance Hey, I need to generate a script which tells me how long it takes for an external page to load... Please can you help? Thanks In the past I always combine my PHP Form Processing Code with my HTML Forms in one script, and when the User clicks "Submit", the Form/Page reloads itself. Is it possible to load an Upload Form to itself? Something like this... Code: [Select] <form enctype="multipart/form-data" action="" method="post"> Debbie Ok, so I have some basic jquery allowing me to refresh and "hopefully" track _SESSION changes. I am running into a issue where only basic PHP functions and variables can be used inside. jQuery Code Loading PHP page Code: [Select] <script type="text/javascript"> var auto_refresh = setInterval( function () { $('#load_options').load('session_options.php'); }, 5000); // refresh every 10000 milliseconds </script> <div id="load_options" style="position:fixed; z-index:100; margin-left:700px; width:200px; padding:10px; background-color:#fff;"> <?php require("session_options.php"); ?> </div> session_options.php <p><?php echo $myNow = date("g:i:s A"); ?></p> <div class="cartinfo"> <h1><b><?php echo $_SESSION['dep_city']; ?>⇒<br /><?php echo $_SESSION['arr_city']; ?></b></h1> <p>Date: <b><?php echo $_SESSION['dep_date']; ?></b></p> <p>Passengers: <b><?php echo $_SESSION['passengers']; ?></b></p> <p>Cost: $<b><?php echo $_SESSION['total']; ?></b></p> <br /> ...blah blah blah What I end up seeing is the Time (WHICH DOES REFRESH PROPERLY) & the static text. HOWEVER, right before the 1st refresh takes place all the variables WORK.... but as soon as that refresh hits... poof "black hole of death". If i include the file with PHP it all works perfectly, but then it won't refresh and update . When a person visits my site I would like for the form on the page to submit and reload with the predetermined search criteria. Is this possible? So for example...if you visited my site as soon as you entered the from would submit and display Google search results for "php freaks" I tried header("location: mysite.com?q=php+freaks"); but that is a continuous loop. -Any thoughts Hi, I've been wondering if it is possible to load a php page according to certain time. For example at 12:00 pm a php form will pop up automatically informing an employee to fill in something in the form, another form will pop up at 4:00 pm, etc... Thanks in advance |