How to use imagefill() from file? - php

Thanks for looking at this question.
I wanted to know how can I use the GD function imagefill() to patch an image with another image.
imagefill() currently accepts resource of a color.
I can do that. But wanted to know how this can be done with a file.
I noticed a user note - But that didn't worked and took a long time for completion :-( http://www.php.net/manual/en/function.imagefill.php#84288

Okay people, have figures it out...
One needs to use imagecopymerge() function to achieve what i was trying to.
Thanks to all the viewers!

Related

How to convert JPG to PNG on upload in WordPress (via add_image_size)?

I asked this some days ago already over here at wordpress.stackexchange.com but didn't get any response since – so I thought it would be legit to ask over here again:
I am looking for a way to have one of the additional images sizes saved as PNG. Ideally the PNG-Version would be rendered on upload and defined through add_image_size.
So far I have only found one WP-plugin that has the built in capability of converting JPGs to PNGs (EWWW Image Optimizer) but it does not really provide the functionality I'm looking for.
I know this should be possible through the PHP function imagecreatefromjpeg – but currently I just don't know where / how to hook that into add_image_size or wherever taht should be hooked in.
I hope somebody has done this before? Any pointers / suggestion appreciated. Thank you!

Help Needed on PHP Image Upload, Slice and Give them a link

I want to upload an image in PHP and after uploading I need to provide the facility to slice it and give each slice a link (As MAP tag in HTML) to a different page. If anyone know a library or a class that I can use to do so please post a reply. Thanks a lot in advance.
The GD library will work just fine for you.
As an alternative, ImageMagick is also available.

php mosaic script

I'm using a script that I downloaded from google code to dynamically generate mosaic images with the GD library. The script seems a bit convoluted. I've messed around with it quite a bit, but I'm sort of confused since it's written in German and I don't speak deutsch. I know that in order for it to work, I need to have 121 different images. But, I'm not sure if they needs to be in the directory or in mysql. Does anyone have a clue as to how to use this? Or does anyone have some suggestions for a better script for generating mosaic images with the php GD library?
The script can be found here: http://code.google.com/p/phpmosaic/
Thanks,
Lance
The images you like to use as thumbnails have to be inside a directory. You must add them to the db using the methods
phpMosaicImageParser::parseImageFolder() or
phpMosaicImageParser::parseImage()
However: there is no fix number of required thumbnails, it will depend on the SourceImage and the used options how much thumbnails you'll need at least.

Require a PHP Image Resizer/Cropping Script

I am grabbing links to images and need to convert them on the fly to 72x108 to display on a website. The source images come from various resolutions, so cropping is required.
I know a moderate level of PHP so I can probably make something work for my needs, but was hoping for something that could be called by a url request. EG: mysite.com/thumbnail.php?src=http://anothersite.com/image.jpg&w=72&h=108
That would be ideal, it needs to support jpg/png.
Thanks in advance!
Here is a really handy script for processing and uploading images that's been a top google result for forever. I used it years ago and it was really easy to implement. Looks like it was just updated a couple weeks ago too :)
http://www.verot.net/php_class_upload.htm
This may be overkill, but if you check out the examples you can see there's a lot you can do with it. If you don't use it for this project, it might be worthwhile to try out for the next one.
just read the image from the url with file_get_contents or using curl and use the php gd library to resize and crop the image as per your needs.
Go through the following links for more info:
http://php.net/manual/en/function.file-get-contents.php
http://php.net/manual/en/book.image.php
http://davidwalsh.name/download-urls-content-php-curl

Php code for getting the first frame of a video(flv)

I have using flow player for playing my .flv videos.How i can create a thumbnail from the first frame.Is their any inbuilt Php code for doing this one.
Thanks in advance.
The only way I know of is using FFMPEG. I have never used this script, but looking at it seems to be what you need, and may need some tweaking.
http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/447/show-first-frame-as-preview-image
EDIT
To get the image / display it you would just use the html code:
<img src="http://my.domain.com/path-to-file/ffmpeg_image.php?file=video.flv&time=00:00:00&browser=false" />
From what I gathered from that script. But of course, it would probably be better to, when you upload the video, run that and generate a "cache" of the image so that whole process does not have to run for each call.
Not exactly what you are looking for but a good way of showing the first frame of a video in flowplayer is to set autobuffering to true:
clip: {
autoPlay: false,
autoBuffering: true,
}
This will load the video (wich might be very bad for you).
To do it yourself you need something like ffmpeg installed on your system. if it is installed check this out.
Hmm, some guy on the forums needed something similar and I tried to help him, idiot-proof style. Check out the last post on this thread. I hope it helps.
link

Categories