Jump to content

Recommended Posts

I'm trying to work out how to resize my image.

I have the following code, which writes my copyright notice across the image (this is for an image bank) but I'd also like to add a watermarked logo to the image aswell as resize the final image.

I tried everything I can think of but the only working version I have (which doesn't do everything I'd like) is this:

[code]<?php

// Set dimension of image
$Height = 200;
$Width= 300;

// Now make it
$im = ImageCreateFromGif($root.$img_details['url']);
$White = ImageColorAllocate ($im, 100, 100, 100);
$Blue = ImageColorAllocate ($im, 0, 0, 64);

// Resize it:
//$im = ImageCopyResized($Width,$Height);

// draw on image
ImageFill ($im, 0, 0, $blue);
ImageLine ($im, 0, 0, $Width, $Height, $White);
ImageString($im, 11, 2, 5, 'Copyright Protected', $White);
ImageString($im, 11, 2, 25, 'By Next Day Graphics', $White);
ImageString($im, 11, 2, 45, 'Sample Only', $White);

// output image
ImagePng ($im);

// clean up
ImageDestroy($im);?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/13131-image-manipulation-using-the-gd-library/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.