Tags » Php

scaling watermark to fit the image php

header('content-type: image/jpeg');

$imgpath = "../image/path" ; 
//OR $imgpath = $_POST["image"] if you will do this on the fly

$image = imagecreatefromjpeg($imgpath);
$imageSize = getimagesize($imgpath);

$watermark = imagecreatefrompng('watermark/path');

$watermark_o_width = imagesx($watermark);
$watermark_o_height = imagesy($watermark);

$newWatermarkWidth = $imageSize[0]-20;
$newWatermarkHeight = $imageSize[1]; 
// OR $newWatermarkHeight = $watermark_o_height * $newWatermarkWidth / $watermark_o_width; 
// IF you would to fit watermark image with image dim

imagecopyresized(
	$image, 
	$watermark, 
	$imageSize[0]/2 - 
	$newWatermarkWidth/2, 
	$imageSize[1]/2 - $newWatermarkHeight/2, 
	0, 
	0, 
	$newWatermarkWidth, 
	$newWatermarkHeight, 
	imagesx($watermark), 
	imagesy($watermark)
);

imagejpeg($image); 
// OR imagejpeg($image,"save/image/path"); 
// if you would to save new image

imagedestroy($image);
imagedestroy($watermark);

Php

php paypal guide

Paypal Use Case

PayPal use cases describe business scenarios that you can address, using PayPal products.
https://developer.paypal.com/webapps/developer/docs/classic/use-cases/

Adaptive Payments

The Adaptive Payments API allows merchants and developers to pay almost anyone and set up automated payments. 98 more words

Php

Installing xDebug PHP module causes - wrong ELF class: ELFCLASS64 - error

Problem description: You had installed lampp to work on some web projects of yours. After a while you decided that it’s time to set up some IDE and chose xDebug to be responsible of PHP debugging. 188 more words

Php

Installing xDebug PHP module on XAMPP on Ubuntu

  • Download Latest XDebug Source file
  • Unpack package, run: tar -xvzf xdebug-2.2.1
  • Run: cd xdebug-2.2.1
  • Run: phpize
  • Run: sudo apt-get install g++-multilib
  • Run: CFLAGS=-m32 CPPFLAGS=-m32 ./configure…
  • 67 more words
Php

Installing PHPUnit on XAMPP on Ubuntu

the unit testing framework that is used within the yii framework to carry out unit tests on things like class methods etc. It should be installed using the PEAR installer that comes with PHP. 307 more words

Php

RESTful Web services

Representational State Transfer (REST)

REST defines a set of architectural principles by which you can design Web services that focus on a system’s resources

REST Web service follows four basic design principles: 634 more words

Php

CSRF - Cross Site Request Forgery

What is CSRF or Cross Site Request Forgery ?

allows an attacker to capture and replay a previous request, and sometimes submit data requests using image tags or resources on other domains. 314 more words

Php