I'm in the beginning stages of writing a plugin to display YouTube videos in a WordPress implementation. Here is my code:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Youtube');
$yt = new Zend_Gdata_YouTube();
function getAndPrintVideoFeed($location::'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
function printVideoFeed($videoFeed) {
$count = 1;
foreach ($videoFeed as $videoEntry) {
echo "Entry # " . $count . "\n";
printVideoEntry($videoEntry);
echo "\n";
$count++;
}
}
All I get is this error:
I am using MAMP. php is version 5.4.10.
Switching the $location:: above for a $location = I get no errors within the actual plugin file itself but rather in loading various components of Zend.
Errors:
Warning: include_once(Zend/Gdata/Youtube.php): failed to open stream:
No such file or directory in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 134
Warning: include_once(): Failed opening 'Zend/Gdata/Youtube.php' for
inclusion
(include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 134
Warning: require_once(Zend/Exception.php): failed to open stream: No
such file or directory in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 86
Fatal error: require_once(): Failed opening required
'Zend/Exception.php'
(include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 86
What is wrong with my code? Is there a better way I can go about all this?
function getAndPrintVideoFeed($location::'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
Should? possibly? be this: Not familiar with ZF buth this is the regular syntax atleast.
function getAndPrintVideoFeed($location = 'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
Related
I need help with these few errors here
`[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(unifont/ttfonts.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(): Failed opening 'unifont/ttfonts.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[06-May-2018 20:08:16 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508`
This is the line 507:
if (!isset($type) || $type != "TrueTypesubset") {
include_once($this->_getfontpath().'unifont/ttfonts.php');
line 507>>> $ttf = new TTFontFile();
And this is line 508
$ttf = new TTFontFile();
I updated the paths to this :
if ($uni) {
if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file )) { $ttfilename = _SYSTEM_TTFONTS.$file ; }
else { $ttfilename = $this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/unifont/'.$file ; }
$filename = $file;
$filename =str_replace(' ','',$filename );
$filename =str_replace('-','',$filename );
$unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($filename ,0,(strpos($filename ,'.'))));
$diff = '';
$enc = '';
if (file_exists($unifilename.'.mtx.php')) {
include($unifilename.'.mtx.php');
}
if (!isset($type) || $type != "TrueTypesubset") {
include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');
$ttf = new TTFontFile();
This is the font folder:
squid\lib\tfpdf\font
full path: /Applications/MAMP/htdocs/squid/lib/font/
This is the unifont folder
squid\lib\tfpdf\font\unifont
Full path: /Applications/MAMP/htdocs/squid/lib/font/unifont
When i change the paths i get this error:
[08-May-2018 14:38:02 America/New_York] PHP Warning: include_once(/Applications/MAMP/htdocs/squid/lib/font/): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[08-May-2018 14:38:02 America/New_York] PHP Warning: include_once(): Failed opening '/Applications/MAMP/htdocs/squid/lib/font/' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[08-May-2018 14:38:02 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508
include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');
This gives an error because you're trying to include an entire folder, you need to specify a filename
$ttf = new TTFontFile();
This gives an error because the class TTFontFile is not defined, maybe its in another file that you didn't include.
Seems like the path returned by
$this->_getfontpath()
is incorrect, or the file you are looking to include is not installed at that path.
You should figure out what $this->_getfontpath() returns, where it is defined. Then see if that path exists and what files are there. Also reading the docs for the library you are installing should help you troubleshooting.
Try changing
/Applications/MAMP/htdocs/squid/lib/font/
to
/squid/lib/font/
does that help?
I am using phpMYADMIN and netbeans for coding, when pressing run project in netbeans at the top of my page I get this error: `
Warning: include(utils/mysql.class.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\autonuoma\index.php on line 6
Warning: include(): Failed opening 'utils/mysql.class.php' for inclusion (include_path='C:\xampp1\php\PEAR') in C:\xampp1\htdocs\autonuoma\index.php on line 6
My whole is index.php is:
<?php
// nuskaitome konfigūracijų failą
include 'config.php';
// iškviečiame prisijungimo prie duomenų bazės klasę
include 'utils/mysql.class.php';
// nustatome pasirinktą modulį
$module = '';
if(isset($_GET['module'])) {
$module = mysql::escape($_GET['module']);
}
// jeigu pasirinktas elementas (sutartis, automobilis ir kt.), nustatome elemento id
$id = '';
if(isset($_GET['id'])) {
$id = mysql::escape($_GET['id']);
}
// nustatome, kokia funkcija kviečiama
$action = '';
if(isset($_GET['action'])) {
$action = mysql::escape($_GET['action']);
}
// nustatome elementų sąrašo puslapio numerį
$pageId = 1;
if(!empty($_GET['page'])) {
$pageId = mysql::escape($_GET['page']);
}
// nustatome, kurį valdiklį įtraukti šablone main.tpl.php
$actionFile = "";
if(!empty($module) && !empty($action)) {
$actionFile = "controls/{$module}_{$action}.php";
}
// įtraukiame pagrindinį šabloną
include 'templates/main.tpl.php';
?>
When I click some menu option in the webpage it returns an error also:
Warning: include(utils/mysql.class.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\autonuoma\index.php on line 6
Warning: include(): Failed opening 'utils/mysql.class.php' for inclusion (include_path='C:\xampp1\php\PEAR') in C:\xampp1\htdocs\autonuoma\index.php on line 6
Fatal error: Uncaught Error: Class 'mysql' not found in C:\xampp1\htdocs\autonuoma\index.php:11 Stack trace: #0 {main} thrown in C:\xampp1\htdocs\autonuoma\index.php on line 11
My question is, what is causing this? The webpage is loading, but it doesn't let me click anything since mentioned error occurs. I know this might sound very silly but I cannot locate the error
`
I'm trying to generate images with this library, i've followed the example here, but when i run the script i got these errors on my error.log file:
[09-Aug-2015 14:40:54 UTC] PHP Warning: imagettfbbox(): Could not find/open font in /home/user/public_html/my_website/vendor/nmcteam/image-with-text/src/NMC/ImageWithText/Text.php on line 166
[09-Aug-2015 14:40:54 UTC] PHP Warning: imagettfbbox(): Could not find/open font in /home/user/public_html/my_website/vendor/nmcteam/image-with-text/src/NMC/ImageWithText/Text.php on line 182
[09-Aug-2015 14:40:54 UTC] PHP Warning: imagettfbbox(): Could not find/open font in /home/user/public_html/my_website/vendor/nmcteam/image-with-text/src/NMC/ImageWithText/Text.php on line 194
[09-Aug-2015 14:40:54 UTC] PHP Warning: imagettftext(): Could not find/open font in /home/user/public_html/my_website/vendor/intervention/image/src/Intervention/Image/Image.php on line 1300
this is my website structure:
-public_html
-my_website
-vendor
-autoload.php
-nmcteam
-image-with-text
-NMC
-ImageWithText
-Text.php
-intervention
-src
-Intervention
-Image
-Image.php
-
-php
-img_creator.php
-font.ttf
-source.png
and this is my script(img_creator.php):
<?php
// Enable Composer autoloading
require '../vendor/autoload.php';
// Create image
$image = new \NMC\ImageWithText\Image('source.jpg');
// Add text to image
$text1 = new \NMC\ImageWithText\Text('Thanks for using our image text PHP library!', 3, 25);
$text1->align = 'left';
$text1->color = 'FFFFFF';
$text1->font = "font.ttf";
$text1->lineHeight = 36;
$text1->size = 24;
$text1->startX = 40;
$text1->startY = 40;
$image->addText($text1);
// Add more text to image
$text2 = new \NMC\ImageWithText\Text('No, really, thanks!', 1, 30);
$text2->align = 'left';
$text2->color = '000000';
$text2->font = 'fonts/Ubuntu-Medium.ttf';
$text2->lineHeight = 20;
$text2->size = 14;
$text2->startX = 40;
$text2->startY = 140;
$image->addText($text2);
// Render image
$image->render('destination.jpg');
i've searched a lot but i cant find a solution.
this does not works for me.
i've tried to move font in the library folder but neither this solution works.
Try to use an absolute path when setting your font, like so:
$text1->font = dirname(__FILE__) . '/path/to/font/Ubuntu-Medium.ttf';
or if you're on PHP 5.3+
$text1->font = __DIR__ . '/path/to/font/Ubuntu-Medium.ttf';
In your example, the path should be:
$text1->font = __DIR__ . '/font.ttf';
I have seen all the posts about this but none have helped me. I have turned on the allow_URL_fopen and allow_url_include. no go
Tried to play with the url adding http:// and doing absolute path still no go.
Tried to do only /images
If I include the full path it will work.
$pdf->Image('http://vsag.actualizevps.com/process/upload/8/cdv_photo_001.jpg',null,null,55,0,'jpg');
the problem is that im pulling the links from DB
when i pull it it will throw following error -
Warning: getimagesize(vsag.actualizevps.com/process/upload/8/cdv_photo_001.jpg): failed to open stream: No such file or directory in /public_html/fpdf/fpdf.php on line 1213
FPDF error: Missing or incorrect image file: vsag.actualizevps.com/process/upload/8/cdv_photo_001.jpg
That file does exist - vsag.actualizevps.com/process/upload/8/cdv_photo_001.jpg
while ($row = mysql_fetch_array($result))
{
$yn = $row['answer_2'];
$grade = $row['answer_3'];
$answer = $row['answer_1'];
$pict = $row['image_1'];
if (empty($row['image_1']))
{$image1="vsag.actualizevps.com/process/upload/camera.jpg";}
else {$image1 = "vsag.actualizevps.com/process/upload/$pict";}
//$image1 = "http://vsag.actualizevps.com/process/upload/"$row['image_1'];
//$image1 = "http://vsag.actualizevps.com/process/upload/".$imageadd;
if($yn=='' ){$yn = "N/A";}
$pdf->Cell(0,10,$row['question_text'],0,1);
$pdf->Cell(0,10,'Answer - '.$answer,0,1);
$pdf->Cell(0,10,'YES/NO - '.$yn,0,1);
$pdf->Cell(0,10,'Grade - '.$grade,0,1);
//$pdf->Image($image1,null,null,55,0,'jpg');
$pdf->Cell(0,0,$pdf->Image($image1,$xaxis,$yaxis,25,29),0,0,'L',0);
//$pdf- >Image('http://vsag.actualizevps.com/process/upload/8/cdv_photo_001.jpg',null,null,55,0,'jpg');
//$pdf->Image('http://vsag.actualizevps.com/process/upload/8/cdv_photo_002.jpg',null,null,55,0,'jpg');
//$pdf->Image('http://vsag.actualizevps.com/process/upload/8/cdv_photo_003.jpg',null,null,55,0,'jpg');
//$pdf->Cell(0,10,$image1,1,0,1);
$pdf->Cell(0,10,'__________________________________________________________________________________________',0,1);
//$pdf->WriteHTML('<img src="http://vsag.actualizevps.com/models/site- templates/images/vsag_header_logo.jpg">');
}
$pdf->Output();
When I run blow code:
/*** PPT to Image conversion ***/
$ppt_file = 'E:\wamp\www\temp/a.pptx';
$app = new COM("PowerPoint.application") or die("Unable to instantiate PowerPoint");
$app->Visible = true;
$app->Presentations->Open($ppt_file);
$app->Presentations[1]->SaveAs("E:/tmp/outdir",18);
$app->Presentations[1]->Close();
$app->Quit();
$app = null;
It gives me one exception :
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Office PowerPoint 2007Description: PowerPoint could not open the file.' in E:\wamp\www\temp\video_conversion.php:107 Stack trace: #0 E:\wamp\www\temp\video_conversion.php(107): variant->Open('E:\wamp\www\tem...') #1 {main} thrown in E:\wamp\www\temp\video_conversion.php on line 107
I am unable to figure out what is the problem.
This is kind of issue is due to the following factors.
PHP.ini settings
Folder Permission
allow open is not enabled in the server
allowed upload size
Within your error, you see the following message: PowerPoint could not open the file.' in E:\wamp\www\temp\video_conversion.php:107
Does the PHP user have permissions to the file E:\wamp\www\temp/a.pptx?
Try correcting your slashes: E:\wamp\www\temp\a.pptx as / normally refers to an option or argument.
At the end of the day, it appears to be a permissions error, a location issue or alike which is preventing access to that file. Can you open the file with fopen or file_get_contents?
Try this with com class:
COM class Reference: - http://us2.php.net/manual/en/class.com.php
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$ppApp = new COM("PowerPoint.Application");
$ppApp->Visible = True;
$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp
$ppName = "MySlides.ppt";
$FileName = "MyPP";
//*** Open Document ***//
$ppApp->Presentations->Open(realpath($ppName));
//*** Save Document ***//
$ppApp->ActivePresentation->SaveAs($strPath."/".$FileName,17); //'*** 18=PNG, 19=BMP **'
//$ppApp->ActivePresentation->SaveAs(realpath($FileName),17);
$ppApp->Quit;
$ppApp = null;
?>
PowerPoint Created to Folder <b><?=$FileName?></b>
</body>
</html>
Or try this :
$powerpnt = new COM("powerpoint.application") or die("Unable to instantiate Powerpoint");
$presentation = $powerpnt->Presentations->Open(realpath($file), false, false, false) or die("Unable to open presentation");
foreach($presentation->Slides as $slide)
{
$slideName = "Slide_" . $slide->SlideNumber;
$exportFolder = realpath($uploadsFolder);
$slide->Export($exportFolder."\\".$slideName.".jpg", "jpg", "600", "400");
}
$powerpnt->quit();