Dynamically Creating An Image With Imagecreate()
I have a multitude of images that I am trying to bring up dynamically depending on the scenario. These images are different sizes.
To complicare things just a little more, I am rewriting a javaScript. Am I heading into the correct direction?
Here is the original JS that I am attempting to rewrite: (This is most of the way translated to PHP)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Imagecreate Output A Solid Black Image
I'm making thumbnails. I want to first scale down the image before I crop it even smaller. The code below only creates a solid black square. Actually, only $final_im creates an image that's solid black. If I used $im as the output file (if I use this instead: imagejpeg($im, "$new_name") ), it's fine (albeit a very low quality image that does not have the dimensions I desire). I figure the problem lies at the //create final thumbnail section of the code. But, again, everything looks right. I would try other functions like imagecopyresizedbicubic , or imagecopyresampled but my server is using an older GD version, and I cannot upgrade it (ISP's server). PHP Code:
Dynamically Creating A Crontab
Is it possibe to dynamically create a crontab. Say i have a form to enter minute, hour, day, etc... and wanted to create a cronjob that ran to those values. Has anyone done this?
Creating .m3u Files Dynamically
Im looking at creating a playlist program for my server. i have alist of files within my database, and i wanted to be able to place these values into a playlist file. the problem is that i dont know how to get the database to create the playlist form its records. ie, if i uploaded a new file to my server and into the database, then i woudl want the script to automatically grab that file ( SQL i know), anbd the nplace it in the m3u file ( i dont know). Coudl someone recommend a simple method to complete this? or point me in teh righ t doirection for a tutorial?
Creating Queries Dynamically
I've been struggling with a problem for a while and I think that the solution lies in the ability to create queries dynamically. On one page I have a number of drop-down menus created dynamically, so the number of menus can vary. Each drop-down represents a try/touchdown scored, and the user would select from the menu who scored it. On the next page I want to take the info entered and send it to the database, automatically creating new entries for each try/touchdown scored. Code:
Dynamically Creating URLS Based On User Input !
I am looking to create pages on the fly or dynamically based on user input. For example if i have www.example.com and they visit this and enter 'bob' in a textfield and press submit they create www.example.com/bob.html . How would I go about this ? I am guessing I need to create a folder when submit is pressed in my website directory ?
Dynamically Resizing An Image
I want to create a thumbnail image. But I don't want to physically resize each image before uploading it (actually, my client doesn't really have the capability). Can I dictate a height (i.e. 108 px) and have a PHP script that will proportionately size down the image using that height? So, if the original is 360 px wide by 540 px high, the image will automatically size to 108 px high by 72 px wide. How would I do this?
Saving A Dynamically Created Png Image
I have a web site that responds to a user request by sending an image generated dynamically. the request page call is something like this <img id = "picid" src= "generateimage.php?$picName"> Where $picName holds the parameters needed for a particular image generateimage.php sends the request to the server which generates the image as $pngstr and responds: header("Content-Type: image/png".chr(13).chr(10)); header("Content-Length: ".strlen($pngstr).chr(13).chr(10).chr(13).chr(10)); echo $pngstr; Now, I want the user to be able to right click the image and save it with a given name - related to but not exactly $picName, as a png. I also have a set of images forming an animation generated in much the same way as the single image described above. How could I have the user save these? is there an animated png yet?
Dynamically Created Image Into String
i have a dynamically created image represented by an imagehandler, but i don't wanna output to the browser or a file. is it possible to read that image directly into a string?
Uploading A Dynamically-generated Image
I have a script that generates an image based on users' inputs. How would I make it so that the script automatically uploads that image to a different folder on the server? I'm stumped on this one. Does anybody have any ideas?
Dynamically Changing Image Sizes
I have an uploader that uploads an image, then lets the user crop it to the size they want. If the user uploads an image 800 x 600, and i set the height to 400 and width to 300, when i goto crop it, it screws everything up and renders out a solid color.
Creating Watermark With Another Image & Resizing Watermarked Image
I have a script that watermarks an image; it adds a transparent gif over my base image. I also have a script to resize my image. But here is where the problem comes in; these are two different scripts - none of the code will interconnect (variable wise - that is), so I am having a problem trying to piece together a PHP GD Image code that will create a watermark and will then be resized. Below is my code for resizing my image, but from there - I know I need to use imagecreategif somewhere and imagecopy somewhere; but where, I do not know. Code:
Centering Text In A Dynamically Created Image
These are live stats from my forum, taken from my database. As you can see, it looks ok, as long as the values are pretty uniform, but when I get a board style that is only three characters long like this one: Then It starts to look weird, does anyone know how I can center the text and the avatar within a certain area? The max size for a username is 18 characters, the max length for theme is 11 characters, the shortest is 3, the post count, join date, and last visit date still need to be centered, but length doesn't really matter with those. Also, the max size for the avatars are 100x100, the minimum is anything less than that. I know I could get the width of the picture and do some math to figure out where to put it, right now, at full size, the x and y coordinates of the picture are: (45, 48), so that would be the maximum, but I can't figure out how I would calculate the location for things smaller than that.
Creating Image From Uploaded Image And Transparent PNG
Say the client wants to be able to change the image, but not the text treatment, and doesn't have the Photoshop knowledge to actually replace it and re-save it themself. Is there anyway to use a PNG with the rounded edges, text treatment, and transparent center, have the client upload a standard rectangular-shaped image, and use PHP to layer the uploaded image underneath the transparent one, creating a new image file?
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
Creating An Image
I am making a links page for my site that takes the links out of the database and displays the name on a button, but the text on each button is different lengths and I was wondering if there was a way I could align them center on the button? This is the button.php code: <?php header ("Content-type: image/png"); $string = $_GET['text']; $im = @imagecreatefrompng ("button1.png"); $text_color = imagecolorallocate ($im, 255, 255, 255); imagettftext($im, 10, 0, 5, 35, $text_color, "c:phpfontsariblk.ttf", "$string"); imagepng ($im); imagedestroy($im); ?>
Creating A Image Gallery
I'm working on a image gallery and I can't figure out the best way to do it. Is it such a good idea to store all images on a MySql database or locally? If i'm going to store images on a MySql database, how is this done, can you upload a whole directory? Right now it's coded to load images locally but then comes the problem how to sort everything up, like show 10 images per page, 5 per row etc. I would like any sugguestions on this. And one more thing, how do I display more than one image per row? Not sure if that's making any sense but here's the code i'm using:
Creating An Image File With Only PHP
Is it possible to create an image file from a string using only functions from core PHP (in other words, without 3rd party libraries/applications)? I'm interested in any image file that is displayable without plugins or helper applications, like jpg, png, gif.
GD Creating A Watermarked Image
I wrote a function which watermarks an image. The function works, but i can't figure out how to output the image into a file. I want to feed this function a URL, $image..and at the end of this code, I want to overwrite the $image file with the new watermarked $image file. Im getting an error stating that this file cannot be opened. <?php function watermark($image) { //$image = $HTTP_GET_VARS['image']; // Useful if using in an img tag to call images //$image = str_replace(array("/", ".."), "", $image); // Prevent abuse $overlay = '/home/httpd/vhosts/picmonkey.com/httpdocs/ADMIN/overlay.png' $dir = '/home/httpd/vhosts/picmonkey.com/httpdocs/IMAGEUPLOADS/' // A default image for the demo...remove if you wish. // Set offset from bottom-right corner $w_offset = 0; $h_offset = 0; $extension = strtolower(substr($image, strrpos($image, ".") + 1)); // Load image from file switch ($extension) { case 'jpg': $background = imagecreatefromjpeg($image); break; case 'jpeg': $background = imagecreatefromjpeg($image); break; case 'png': $background = imagecreatefrompng($image); break; case 'gif': $background = imagecreatefromgif($image); break; default: die("Image is of unsupported type."); }
Creating And Presenting An Image In Php
Maybe this isn't really a PHP problem. But it's possible that PHP has a good solution for it. I have a php page which collects some input from the user, constructs an image, and then displays it to the user. The line of php that does the actual presentation to the user is: print "<a href='$string'><img src='$string' width=784 height=431 border=0></a>"; where $string is something like 'r.pl?ar=7;cl=10' so the user gets to see a (large) thumbnail, and can then click on it to see the full-sized version. (The actual nitty-gritty of the image creation is done in Perl not PHP. I wrote it before I became more familiar with PHP and learned that PHP uses the GD library. I could rewrite it into PHP if I have to.) My problem is that my code calls r.pl twice, to do the same thing: once when the page is created, and once when the user clicks on the image. This wastes quite a bit of cpu time on the server, and slows the response for the user. What I would prefer to do is call r.pl once, put the resulting image in some kind of temporary session-specific file on the server (or in its memory), and then use this temporary thing twice, in place of $string above. Is this somehow possible?
Creating A TIFF Image
I just wondered if there was a function to create a TIFF image using either Image Magick or the GD Library? I have searched through the PHP manual, this forum, blogs and Google and Can't find anything of any use. I thought that imagetiff() might work, but no such luck.
Creating An Image Out Of Multiple Images
I'm designing an application where I want to create a dynamic image out of a matrix of small images, selected by some complex mysql-queries. The small images, each are 30x30 pixels, and the size of the big image will be approx. 300x270 pixels. (so there will be 10 rows, and 9 cols of images) My question: How do I import the small images en embed them into a new, big image?
Creating Thumbnail Image Of A Webpage ?
How do i create a image of webpage in php? Basically what I am looking for is "Create a small image (Thumbnail) of a webpage. Let me know about your thought.
Creating An Image Out Of Multiple Images
I have some questions regarding image manipulation: - Is it possible add an alpha channel to an image via PHP? - Can I multiply an image with another image creating a new image? I want to create border with transparency around images uploaded to an photalbum.
Creating An Hyperlink From A Sql Query Image
I have an sql query that pulls an image filename out and displays that image. echo "<img src='/images/thumbnails/{row["Filename"]}' width='75' height='50'>"; I have another images folder with the larger pictures, they also have the same filename. What I'm trying to do with no success! is for the thumbnail image displayed from the query be an hyperlink to a blank page and display the larger image.
Passing Variables To An Image Creating Php File
I have been working with the gd functions in PHP to render an image. I was able to solve the (apparently) usual header problems and such like via searching through this page and help documentation, such that I am now able to produce an image by doing the following : Code:
Imagecreate()
Does a function called imagecreate() exist in PHP? If so, in what php version? I got a script that uses this function. On one server it works fine, but on another server it says the imagecreate() function is undefined. Why??
Can't Use Imagecreate()
I'm running PHP 4.3.2 on a Win XP box with IIS 5.1. I am completely unable to get any of the image tags to function--it gives me an error such as the following: Fatal error: Call to undefined function: imagecreate() in D:web sites....... I'm at a loss and I need to get this working. My understanding is that 4.3+ has offered these tags so I'm not quite certain as to what I'm doing incorrectly.
Imagecreate
I can get this to work if I manually type in some text and assign it to the $text variable. When I try to assign a file to the text variable all that is displyed is "array". Also, what would be the correct way for me to save the image as "testimage.gif"? Code:
ImageCreate() Or ImageGif()
I want to to something with dynamic graphics. I have a host who supports PHP. Problem: if I try to use ImageCreate() or ImageGif() I get call to undefined function error as return. Could anyone help me out why I get this error ? Is it possible that my host hasn't the GD library installed ?(although they say they have.
Getting ImageCreate () To Work
I am trying to use the ImageCreate() function to create some graphs on a website. It's not working. I was wondering if anyone could help me figure out why this wouldnt work?I am using this test code:
ImageCreate And Php_gd2.dll
The problem I am having is kind of weaving it's way from one thread to another (sorry, I did read the rules), but I thought it was appropriate to start a new php thread on this topic. I am trying to resize and save and uploaded graphic file. The code makes a call to "ImageCreate" where it appears to fail. I have read and done everything regarding including the GD Graphics lib (uncommenting the php_gd2.dll line in the php.ini file), but nothing seems to work. My debugging tools are a tad lame at the moment (calls to a javascript Alert in php code) so all I know is, everything moves along fine until I hit the "ImageCreate" call. The call to Alert after that line never gets called - or doesn't appear. I've tried sticking a call to ImageCreate in other PHP code and the same thing happens. I even copied the php_gd2.dll from the ext/ directory into the php directory. I'm desperate. I'm really making great progress in learning all this stuff but now and again I find myself really suck... like now. The site I am trying to build is so clear in my mind it just makes it more frustrating (I have to keep reminding myself... "the journey is the reward". so, what's the deal with this GD stuff? Also, any advice on better PHP debugging tools would be most appreciated. I'm not ready to go crazy with Eclipse until this thing is further along (I'm using Aptana now).
Gd Library And Imagecreate
When I recently went through a system upgrade to Fedora Core 3, I had to upgrade php. Then, run down the required libraries. All was installed and php 'knows' about everything it should. Including gd. But, when I execute a script off the command line, I get PHP Fatal error: Call to undefined function: imagecreate() in /home/user1/bin/tinyplot.php on line 45 What's bugging me about this is a phpinfo reveals this: configured with --with-gd=shared, --enable-gd-native-ttf. I've read about the extension tag in the php.ini, but nothing much about it in *nix, mostly Win32. When I tried to add the extension tag in the php.ini, I barked that it wasn't a valid php extension. When I do a 'locate libgd', I get the following return: /usr/lib/libgd.so.2.0.0 /usr/lib/libgd.so.2 /usr/lib/php4/libgd.so /usr/local/lib/libgd.a /usr/local/lib/libgd.so.2 /usr/local/lib/libgd.so So, the one in /usr/lib/php4/ should be the appropriate one for php, so waht gives? Suggestions on how to get this rectified?
ImageCreate(); Different Color Text
I am making images, that contain a name and a job title, for each employee, so i want to do it dynamically. i have created the images but i want to know how i can make different parts of the text different colors.
Undefined Funct: Imagecreate
Linux RH New install. PHP installed --with-gd=shared. libgd-2.0... installed in /usr/lib PHP Fatal error: Call to undefined function: imagecreate() If I put extension=gd.so in php.ini I get PHP Warning: Unknown(): Invalid libr (maybe not a PHP library) 'gd.so' Every web search result I get says "just install GD" - Ah, it is... Also what about /etc/ld.so.conf.d? a pointer to /usr/lib? and as gd-i386.conf? gd2.conf? gd.conf?
Fatal Error: Call To Undefined Function: Imagecreate()
./configure' '--with-ldap' '--with-oci8=/home/oracle/OraHome1' '--with-mysql' '--with-apache=../apache_1.3.24' '--enable-transient-id' '--enable-gd=../gd-1.8.4' '--with-jpeg=../jpeg-6b' '--with-png=../libpng-1.2.3' '--with-zlib' everything compiles fine and runs except for when i use GD stuff. Fatal error: Call to undefined function: imagecreate() in ...etc etc etc Anyone have ideas on how to compile this correctly?
GD Functions - Creating A "Simple" Image
I want to create a "simple" square image at a variable height & width.. the image would be either transparent or perhaps use a background color.. And contain a "number" positioned in the top left corner maybe like: ----------------- - 1 - ----------------- Like I said "simple".. since I've yet to look into this, and I've yet to work with the gd library.. I'm wondering if someone can point me to some "examples".. Or perhaps, you already have a function to do just that.. I'm starting to work on a little calendar function, which I've written already.. I basically want to make it a little "schedular" app.. I want to create the image for an "onclick" event.. which opens a "view" of the selected day(s) event(s)... The image will give those (who use those "ancient" browsers) something to click on.. since some older browser do not support "onClick" event assigned to a table cell.
How To Dynamically Name Variables?
Lets say I have variables named: name1, name2, name3, and name4. How can I call them without having to name them everytime. Something like for ($i=1; $i<=20; $i++){ if $"name".$i { do this } I've tried everycombination I can think of, but am totally confused. I had no trouble naming the variables dynamically in a form, but I can't get php to call them dynamically.
PHP To Dynamically Generate XML
I am interesting in using PHP to dynamically create an XML document and then use XSLT to transform to XHTML. I have come across two methods for doing this. I made two equivalent examples so you can see what I mean. http://members.shaw.ca/petermichaux...SLT_method.html I am interested in critisim of how I implemented each method. However my main problem is deciding between methods. Which method is better for bigger programs where the bits of the XML data are assembled by various php functions that I write? For example, one php function queries a database table for a list of CD titles. A second php function loops through this CD title list and gets the track listing for each CD from another table in the database. Then the composite XML data (ie. CD title and tracks as nodes) can be tranformed to XHTML.
Dynamically Naming Variables
i have this script for that uses 7 pulldowns for the time of an event each day of the week that gets inserted in to a db. Instead of writing the script 7 times for taking the data from the pulldowns, creating a time based on the hour, minute and AM/PM -can i create something that dynamically creates varibles. Basically takes something like $hour1, $minute1 and automatically creates $hour2, $minute2 and so on. This is kinda difficult to explain, heres a snippit of code which i want to duplicate.
Dynamically Generate Mp3 Clip
I have page in which user will upload song and i need to automatically generate a 30 second clip of the uploaded mp3 file and save it can anyone suggest how to do this on linux server which software to use is it possible with ffmepg or ffmpeg-php to cut a 30 second clip or 60 second clip etc. if you have any example then please show me how to do that.
Find Domain Name Dynamically
I have 2 registered domains, which point to the same web root folder. I would like to display a different logo image depending on which domain the user requested. Is it possible to find the domain name with PHP?
How To Change Data Dynamically ...
I'm developing a system where user has a previlage to select his/her COUNTRY then STATE then CITY respectively. i've put all the Country names, State names and City name in a Drop-Down combos which is filled dynamically from the MySQL database. Now my problem is that i want it in such a way that if one select USA as COUNTRY then all the STATE(s) of USA should be displayed on the STATE combo not any other. and then when user selects the STATE in the next combo the CITY combo should be populated with cities related to that STATE only and not with any other.
Dynamically Generate Mp3 Clip
I have page in which user will upload song and i need to automatically generate a 30 second clip of the uploaded mp3 file and save it. can anyone suggest how to do this on linux server which software to use? is it possible with ffmepg or ffmpeg-php to cut a 30 second clip or 60 second clip etc
Updating BIND Dynamically
I am about to start an indepth project for the company I work for. We want to use a PHP front end and be able to make updates to DNS dynamically. I was wondering if I can get some opinions on where to start.
Dynamically Populate PDF Form
I found a free script/class online a few months ago which enabled me to populate pre-built PDF forms with data using PHP; without using any toolkits etc (it worked perfectly). It was simply a PHP script. I lost the script when my PC died recently DOH! Does anybody know where I can find such a script again? I have searched google all night, but all I find is commercial products (not cheap!) or toolkits for generating PDFs', not filling pre-built PDF forms. Here is what I am trying to do: I have built a site for a client which incorporates e-learning. Students take lessons and if at the end of the course their grades are sufficient, they download a PDF certificate. The certificate is in PDF format with Form Fields for the required data. The certificate needs to display the students name, grade and course name. I need a PHP script which can import server-side data into a PDF form which the user can then print or save (flat). The last (and lost) script did this so I know it is possible.
PHP To Dynamically Make New Pages? DOH!
I am building a CMS system for a client to edit add and remove content from his new site, not a problem however he now wants the facility to create new pages and be able to edit the new pages, how do you create a new page dynamically using php and mysql? As in he needs to make a new page called untitled2.php for example, with the title at the top of the page, a description about untitled 2 and then save the newly created page so it appears in the menu and actually exists in the remote server files, then be able to edit this using the CMS system? ERM... Any standard commands as in create_page()? How would I make the new page have variables included so that it could echo mysql content onto the newly created page?
|