1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Improved logo in PDF

This commit is contained in:
Hillel Coren 2014-03-18 22:43:12 +02:00
parent 48130290ce
commit 0f9f32dd49
8 changed files with 27 additions and 10 deletions

View File

@ -6,7 +6,7 @@
Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is the codebase will serve as a sample site for Laravel as well as other JavaScript technologies.
For updates follow [@invoiceninja](https://twitter.com/invoiceninja) and [@hillelcoren](https://twitter.com/hillelcoren)
For updates follow [@invoiceninja](https://twitter.com/invoiceninja) or join the [Facebook Group](https://www.facebook.com/invoiceninja)
Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)

View File

@ -530,7 +530,7 @@ class AccountController extends \BaseController {
{
$path = Input::file('logo')->getRealPath();
File::delete('logo/' . $account->account_key . '.jpg');
Image::make($path)->resize(120, 80, true, false)->save('logo/' . $account->account_key . '.jpg');
Image::make($path)->resize(null, 120, true, false)->save('logo/' . $account->account_key . '.jpg');
}
Event::fire('user.refresh');

View File

@ -206,6 +206,12 @@ class InvoiceController extends \BaseController {
public static function getViewModel()
{
// Temporary fix to let users know to re-upload their logos for higher res
if (Auth::user()->account->getLogoHeight() == 80)
{
Session::flash('warning', "We've increased the logo resolution in the PDF. Please re-upload your logo to take advantage of it.");
}
return [
'account' => Auth::user()->account,
'products' => Product::scope()->orderBy('id')->get(array('product_key','notes','cost','qty')),

View File

@ -166,7 +166,13 @@ HTML::macro('breadcrumbs', function() {
$str = '<ol class="breadcrumb">';
// Get the breadcrumbs by exploding the current path.
$crumbs = explode('/', str_replace(Utils::basePath(), '', $_SERVER['REQUEST_URI']));
$basePath = Utils::basePath();
$path = $_SERVER['REQUEST_URI'];
if ($basePath != '/')
{
$path = str_replace($basePath, '', $path);
}
$crumbs = explode('/', $path);
foreach ($crumbs as $key => $val)
{
@ -175,6 +181,7 @@ HTML::macro('breadcrumbs', function() {
unset($crumbs[$key]);
}
}
$crumbs = array_values($crumbs);
for ($i=0; $i<count($crumbs); $i++) {
$crumb = trim($crumbs[$i]);

View File

@ -29,7 +29,7 @@
{{ Former::text('name') }}
{{ Former::text('work_email')->label('Email') }}
{{ Former::text('work_phone')->label('Phone') }}
{{ Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp('Supported: JPEG, GIF and PNG. Recommended size: 120px width, 80px height') }}
{{ Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp('Supported: JPEG, GIF and PNG. Recommended height: 120px') }}
@if (file_exists($account->getLogoPath()))
<center>

View File

@ -164,6 +164,10 @@
{{ HTML::breadcrumbs() }}
@endif
@if (Session::has('warning'))
<div class="alert alert-warning">{{ Session::get('warning') }}</div>
@endif
@if (Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif

View File

@ -578,8 +578,8 @@
@if (file_exists($account->getLogoPath()))
invoice.image = "{{ HTML::image_data($account->getLogoPath()) }}";
invoice.imageWidth = {{ $account->getLogoWidth() }};
invoice.imageHeight = {{ $account->getLogoHeight() }};
invoice.imageWidth = {{ $account->getLogoWidth() * (72/96) }};
invoice.imageHeight = {{ $account->getLogoHeight() * (72/96) }};
@endif

View File

@ -15,7 +15,7 @@ function GetReportTemplate4(doc, invoice, layout, checkMath) {
if (invoice.image)
{
var left = layout.headerRight - invoice.imageWidth;
doc.addImage(invoice.image, 'JPEG', left, 30, invoice.imageWidth, invoice.imageHeight);
doc.addImage(invoice.image, 'JPEG', left, 20);
}
/* table header */
@ -700,7 +700,7 @@ function GetReportTemplate1(doc, invoice, layout, checkMath)
if (invoice.image)
{
var left = layout.headerRight - invoice.imageWidth;
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, layout.accountTop, invoice.imageWidth, invoice.imageHeight);
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, 20);
}
if (invoice.imageLogo1)
@ -822,7 +822,7 @@ function GetReportTemplate2(doc, invoice, layout, checkMath)
if (invoice.image)
{
var left = layout.headerRight - invoice.imageWidth;
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, 30, invoice.imageWidth, invoice.imageHeight);
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, 30);
}
Report2AddFooter (invoice,doc);
@ -1140,7 +1140,7 @@ function GetReportTemplate3(doc, invoice, layout, checkMath)
{
y=130;
var left = layout.headerRight - invoice.imageWidth;
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, y, invoice.imageWidth, invoice.imageHeight);
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, y);
}
Report3AddFooter (invoice, account, doc, layout);