In my Controller file i wrote the following code for attaching an image to the mail,But it gives an error
$email->attachments(array('/localhost/projname/app/webroot/img/file.png'));
It shows an error like File not found: ""
You can use the IMAGES constant to get the file path to the images folder:
$email->attachments(array(IMAGES.DS.'file.png'));
Finally I got solution for attaching Images
$email->attachments(array (
array('file'=>ROOT.'/app/webroot/img/car.gif',
'mimetype'=>'image/png'
),
));
Related
I am new in cakephp. I am getting the following error in my page.
Error: Class 'cakeplugin' not found
File: C:\wamp\www\cakephp\app\Config\bootstrap.php
Line: 27
Notice: If you want to customize this error message, create app\View\Errors\fatal_error.ctp
To load all plugins that you have added, put this in your config/bootstrap.php, :
CakePlugin::loadAll();
When I try to access the pdf file which is public using the angular-pdf-viewer I got the following error message on console.
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 5 of the expression [http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf] starting at [://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf].
here is my pdf directive for rendering the pdf file:
<pdf-viewer delegate-handle="my-pdf-container" url="http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf" scale="1" show-toolbar="true" ></pdf-viewer>
could anyone help on this issue?
all the samples seems to be suggesting define url on scope and reference it. But you may try the following, which stringifys the url
<pdf-viewer delegate-handle="my-pdf-container" url="'http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf'" scale="1" show-toolbar="true" ></pdf-viewer>
I am trying to render images/pdfs that exist outside of my webroot. So this is what I'm doing in my controller to Send the File - as described here. But I'm getting a Fatal Error. Any ideas why and how to fix this? I'm running CakePHP 2.4.5.
$this->autoRender = false;
$path = '/path/to/valid/file.pdf';
$this->response->file($path);
return $this->response;
Fatal error: Call to undefined method Folder::slashTerm()
Stack trace:
{main}() /Path/To/My/htdocs/mysite/app/webroot/index.php:0
Dispatcher->dispatch() /Path/To/My/htdocs/mysite/app/webroot/index.php:96
Dispatcher->_invoke() /Path/To/My/htdocs/mysite/lib/Cake/Routing/Dispatcher.php:160
Controller->invokeAction() /Path/To/My/htdocs/mysite/lib/Cake/Routing/Dispatcher.php:185
ReflectionMethod->invokeArgs() /Path/To/My/htdocs/mysite/lib/Cake/Controller/Controller.php:490
PagesController->load_media() /Path/To/My/htdocs/mysite/lib/Cake/Controller/Controller.php:490
CakeResponse->file() /Path/To/My/htdocs/mysite/app/Controller/PagesController.php:227
File->__construct() /Path/To/My/htdocs/mysite/lib/Cake/Network/CakeResponse.php:1265
File->pwd() /Path/To/My/htdocs/mysite/lib/Cake/Utility/File.php:91
Problem solved. I had a Plugin that had a class Folder that was taking this over.
I`m trying to create a page that read the metadata of an image and allow user to edit it and save it to the same image.
After searching the internet I have found exiftool as the solution but I can make it work only as a command line not as a library in the page.
I have this code:
eval('$metadata=' . exiftool.exe -php -q $imagePath);
foreach ($metadata[0] as $key => $value) {
if ($metadata[0][$key]!=$_POST[$key]){
if ($_POST[$key]=="") $_POST[$key]=" "; //if metadata is not set, than create an empty metadata
eval('$metadata=' . exiftool.exe "-$key=$_POST[$key]" $imagePath);
}
}
and I`m getting this error:
Parse error: syntax error, unexpected 'image' (T_STRING) in E:\xampp\htdocs\imgdata\index.php(30) : eval()'d code on line 1
I tried to replace the ` with other like " and ' but no luck.
What do I miss?
Any better idea on how to do it?
Thanks
I had the same problem, but using Centos OS, and found a solution here:
'command not found' error when using subprocess in apache
Might not work for Windows but worth a look. Basically the answer suggests specifying the full exiftool path rather than simply exiftool.exe.
If that doesn't help then have a look for errors in the Apache Error Log File.
i am trying to figure out this weird issue using TCPDF and CakePHP.
the fact is that i am able to output a "static" image like this
$this->Image(WWW_ROOT.'/img/logo-infiniti.png', 15, 15);
but when i use cakephp instruction for images it doesn't work anymore
echo $this->Image->resize($line['Line']['UploadImage'][0]['name'], 100, 100);
and i get this error
TCPDF ERROR: [Image] Unable to get image: /Applications/MAMP/htdocs/configurator/files/cache/a/a/79x100_1316533443.jpg
any help will be very appreciated...thanks!
use chmode() function to give permission Applications/MAMP/htdocs/configurator/files/cache to 777