Larger image pop up using php / database

Hi,
My photographic site gallery section runs off a data base
where the images
are uploaded via a content management system into the folder
images/photos.
The images are then loaded from this folder and run through a
downsizing
script to their appropriate areas ie gallery thumbnails and
gallery images.
What I am wanting to do is add a section on the image page so
people can
view a larger image.
I have made a _blank link made to
seelarger.php?im=images/photos/<?=$image?> on the image
page with a text
link
and the image on the seelarger.php is
images/photos/<?=$image?>
This isnt working.... how can I transfer the image on the
image page to a
another page.
Thanks
Matt
Matt Lauder Gallery
Panoramic Images of Australia
www.mattlauder.com.au
0414 374 533

Do I replace the
seelarger.php?im=<?php echo urlencode($image); ?> code
you gave me before
with
seelarger.php?im=<?php echo urlencode($image);
?>&amp;title=<?php echo
urlencode($title); ?>
and can you confirm what code I need on the seelarger.php
page.
as I replaced the seelarger.php?im=<?php echo
urlencode($image); ?> code
with the new one you gave and nothing happened.
Thanks
Matt
"David Powers" <[email protected]> wrote in message
news:ej84c4$283$[email protected]..
> matt wrote:
>> Excellent.... worked perfectly thankyou.... now how
do I do the same with
>> the title.... on the image page I have it as
<?=$title?>
>>
>> And on the seelarger.php I have it as echo
>> "<title>{$_GET[title]}</title>";
>
> You need to pass the variable from one page to the next.
It doesn't just
> appear by magic.
>
> seelarger.php?im=<?php echo urlencode($image);
?>&amp;title=<?php echo
> urlencode($title); ?>
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
>
http://foundationphp.com/

Similar Messages

  • Uploading images for a mySQL / PHP database

    Hopefully this can be done - I'm working on a site that uses
    a simple mySQL database, where the records include an image.
    I have the form to add records, including the field
    containing the file name - but is it also possible to upload the
    actual file using the same form to their folder, or does that need
    to be done separately using FTP software?
    The idea is for my client to be able to as easily as possible
    add / delete / edit records himself, so clearly getting the actual
    images uploaded at the same point he adds records to the database
    would be great if that's possible.
    Cheers,
    Iain

    The PHP.NET site really covers it in considerable detail.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "David Powers" <[email protected]> wrote in message
    news:ejo4qf$ee3$[email protected]..
    > Iain71 wrote:
    >> Cheers for that - not sure exactly what I need to do
    tho'
    >
    > I'm sure there are plenty of online tutorials if you
    Google for them. I
    > also cover file uploads in my new book, PHP Solutions.
    It's not
    > particularly difficult, but there are quite a few steps,
    and you need to
    > be aware of security considerations.
    >
    > --
    > David Powers
    > Adobe Community Expert
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    >
    http://foundationphp.com/

  • Database much larger than expected when using secondary databases

    Hi Guys,
    When I load data into my database it is much larger than I expect it to be when I turn on secondary indexes. I am using the Base API.
    I am persisting (using TupleBindings) the following data type:
    A Key of size ~ *80 Bytes*
    A Value consisting of 4 longs ~ 4*8= *32 Bytes*
    I am persisting ~ *280k* of such records
    I therefore expect ballpark 280k * (80+32) Bytes ~ *31M* of data to be persisted. I actually see ~ *40M* - which is fine.
    Now, when I add 4 secondary database indexes - on the 4 long values - I would expect to see approximately an additional 4 * 32 * 280k Bytes -> ~ *35M*
    This would bring the total amount of data to (40M + 35M) ~ *75M*
    (although I would expect less given that many of the secondary keys are duplicates)
    What I am seeing however is *153M*
    Given that no other data is persisted that could account for this, is this what you would expect to see?
    Is there any way to account for the extra unexpected 75M of data?
    Thanks,
    Joel
    Edited by: JoelH on 10-Feb-2010 10:59
    Edited by: JoelH on 10-Feb-2010 10:59

    Hi Joel,
    Now, when I add 4 secondary database indexes - on the 4 long values - I would expect to see approximately an additional 4 * 32 * 280k Bytes -> ~ 35MA secondary index consists of a regular JE database containing key-value pairs, where the key of the pair is the secondary key and the value of the pair is the primary key. Your primary key is 80 bytes, so this would be 4 * (4 + 80) * 280k Bytes -> ~ 91M.
    The remaining space is taken by per-record overhead for every primary and secondary record, plus the index of keys itself. There are (280k * 5) records total. Duplicates do not take less space.
    I assume this is an insert-only test, and therefore the log should contain little obsolete data. To be sure, please run the DbSpace utility.
    Does this answer your question?
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can you upload an image to MYSQL using php?

    Ok this is a joint thread with one of my other ones because no one else  was posting on it, so I did not get what I needed, so, How can you  upload an image to mysql so when some one logs on to my site, they see  or can upload there own avatar, now there are loads of problems with  this, 1) many people don't know how, 2) It's not every day you try to  encode a image into mysql, 3) Letting people upload images into mysql  can cause traffic problem with people trying to log in. So that's it.

    Uploading images into MySQL is a bad idea, for more reasons than you mention. You should store the images in a directory on the server instead. But if you want to learn the hard way, here is the method:
    The mysql data type must be blob.
    The form enctype must be multipart, like this: enctype="multipart/form-data"
    The form input field myst be type file, like this: <input type="file" name="upload"/>
    Here is example code that prepares the variable $photodata to be inserted into the database.
      $uploadfile = $_FILES['upload']['tmp_name'];
      $photoname = $_FILES['upload']['name'];
      $uploadtype = $_FILES['upload']['type'];
      if ($uploadfile != "") {
    $tempfile = fopen($uploadfile, 'rb');
    $filesize=filesize($uploadfile);
    $width=getimagesize($uploadfile);
    $widthx=$width[0];
    $heightx=$width[1];
    if (($widthx > 102) or (heightx > 135)){
    $image_too_big = " but the image size was too large and was not submitted.";
    } else {
    $photodata = fread($tempfile, filesize($uploadfile));
    $photodata = addslashes($photodata);

  • Large pages are not used when databases are started from srvctl on ibm aix

    Hi,
    RAC 11.2.0.3.2 on IBM AIX 6.1 TL07. Mixed databases 10.2.0.5.4 and 11.2.0.3.2
    When started with SQLPLUS, the database instance use LARGE PAGES
    When started with SRVCTL, the database instance doesn't use LARGE PAGES, even root has the right capabilities
    lsuser -a capabilities root
    root capabilities=CAP_NUMA_ATTACH,CAP_BYPASS_RAC_VMM,CAP_PROPAGATE
    The same behaviour is observed for 10.2.0.5.4 and 11.2.0.3.2 databases.
    ORACLE_SGA_PGSZ=16m is exported in /etc/profile.
    I found that :
    1) When the node is restarted (shutdown -r now), clusterware and all databases (database 10gr2, 11gr2 , asm, ...) start automaticaly WITHOUT using LARGE PAGES. After this, databases restarted with SQLPLUS are USING LARGE PAGES, and databases restarted with SRVCTL NEVER use LARGE PAGES.
    2) When the clusterware is restarted manualy (crsctl stop|start crs) all databases (database 10gr2, 11gr2 , asm, ...) start automaticaly and all instances (10gr2 and 11gr2) are USING the LARGE PAGES. After this, database are ALWAYS using LARGE PAGES (started with SQLPLUS or SRVCTL)
    So, this problem occurs only after a restart of the host. All is fine after a manual restart of the clusterware.
    my references
    SGA Not Pinned In The AIX Large Pages When Instance Is Started With Srvctl [ID T369424.1]
    How to enable Large Page Feature on AIX-Based Systems [ID 372157.1]
    Thank's for your help

    The problem here is for IBM AIX (I dont find the equivalent for ulimit -l max locked memory, in ulimit for AIX)
    Here a portion of the original /etc/ohasd script (ulimit -c and -n are already set for AIX)
    start_stack()
    # see init.ohasd.sbs for a full rationale
    case $PLATFORM in
    Linux)
    # MEMLOCK limit is for Bug 9136459
    ulimit -l unlimited
    ulimit -c unlimited
    ulimit -n 65536
    ulimit -c unlimited
    ulimit -n 65536
    esac
    So i put a trace
    start_stack()
    # see init.ohasd.sbs for a full rationale
    case $PLATFORM in
    Linux)
    # MEMLOCK limit is for Bug 9136459
    ulimit -l unlimited
    ulimit -c unlimited
    ulimit -n 65536
    ulimit -c unlimited
    ulimit -n 65536
    echo "$(ulimit -a)" > /tmp/coh.log
    echo "$(lsuser -a capabilities root)" >> /tmp/coh.log
    esac
    here is the result :
    time(seconds) unlimited
    file(blocks) unlimited
    data(kbytes) unlimited
    stack(kbytes) 4194304
    memory(kbytes) unlimited
    coredump(blocks) unlimited
    nofiles(descriptors) 65536
    threads(per process) unlimited
    processes(per user) unlimited
    root capabilities=CAP_NUMA_ATTACH,CAP_BYPASS_RAC_VMM,CAP_PROPAGATE
    i continue investigating this way ...

  • How to display image in database using php

    i've try search all hope that you all can give me some guidance how to display data that is in image or BLOB using PHP. just a query and php code that will make display of the image. hope that you all show me the example or give me reference that i need to solve my problem.

    Hi,
    Have a check on these Google results, you might find something there...
    http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&q=%22display%20image%22%2Boracle%20%2Bphp

  • Small iMage pop up larger image then close

    Hi All
    First off I am not a coder :)
    I am building a website and would like to take an image on
    the page, be able to click on image to create larger image (pop up
    on same page) and then be able to close larger image back to
    original image.
    I am using CS4
    Thanks in advance
    Jay
    pcb4u at verizon dot net

    Do I replace the
    seelarger.php?im=<?php echo urlencode($image); ?> code
    you gave me before
    with
    seelarger.php?im=<?php echo urlencode($image);
    ?>&amp;title=<?php echo
    urlencode($title); ?>
    and can you confirm what code I need on the seelarger.php
    page.
    as I replaced the seelarger.php?im=<?php echo
    urlencode($image); ?> code
    with the new one you gave and nothing happened.
    Thanks
    Matt
    "David Powers" <[email protected]> wrote in message
    news:ej84c4$283$[email protected]..
    > matt wrote:
    >> Excellent.... worked perfectly thankyou.... now how
    do I do the same with
    >> the title.... on the image page I have it as
    <?=$title?>
    >>
    >> And on the seelarger.php I have it as echo
    >> "<title>{$_GET[title]}</title>";
    >
    > You need to pass the variable from one page to the next.
    It doesn't just
    > appear by magic.
    >
    > seelarger.php?im=<?php echo urlencode($image);
    ?>&amp;title=<?php echo
    > urlencode($title); ?>
    >
    > --
    > David Powers
    > Adobe Community Expert
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    >
    http://foundationphp.com/

  • How to create a pop-up window with a larger image

    Again, I'm looking to do something very simple and can't figure it out. I want users to be able to hover over/click on an image and there pops up a larger version of the image, much like you see on online catalogs and shopping sites. I've looked into Lightbox and jQuery but don't understand how to incorporate the code into my pages. Is there a simpler way using DW CS4?
    Thanks,
    Gail

    Select the thumbnail image and link it to the larger image file.
    Use DW Behaviors Panel and hit the plus + sign.
    Choose Open Browser Window.  This will invoke another panel for adjusting the size and other attributes of your pop-up window.
    Hit OK.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • RoboHelp 8 HTML WebHelp How to display a larger image of a thumbnail by clicking on or rolling over the thumbnail?

    How would you display a larger image of a thumbnail by clicking or rolling over the thumbnail?

    Hi there
    For a mouseover you would have to add some custom developed JavaScript. You could probably find some pre-made on the web if you poked around.
    Generally speaking, any way you slice it you will be using two images. One for the thumbnail and one for the full sized image. You could employ the popup functionalty to pop up the larger image.
    I used to simply create DHTML drop-downs and insert the large images in the drop-down area.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Large image not loading

    I generate JPGs on my server and send them to clients on an intranet (using http://, not file://). Smaller images work just fine. Large images do not using Firefox, even when trying to view the images by themselves in a new tab. Those same images work perfectly fine in IE 8, Chome v22, and Safari 5.
    I tried the suggestions here to no avail:
    https://support.mozilla.org/en-US/kb/fix-problems-images-not-show?as=aaq
    Similar problem found here:
    https://support.mozilla.org/en-US/questions/795933?as=aaq
    Not sure which attribute might trigger the issues, but I know:
    - 901 x 27928 resolution 3.93 MB picture will load
    - 904 x 32767 resolution 4.77 MB picture won't load
    Looks like the image file is uncorrupted because I can click to view the image in FF, right-click to 'View image info', click 'Save As...' for the image, and save it to my desktop. Opens up just fine in Windows. Seems to be a bug in the way Firefox is attempting to display it...

    That image displays fine for me in Firefox on Linux, but I'm not seeing anything in a Windows Firefox version that runs under Wine.
    Even the Tools > Page Info > Media preview panel is blank there, but saving the image is possible.
    <br />
    <pre><nowiki>data:text/html,<img src='http://imageshack.us/a/img12/4543/visualizedp1776ddv27731.jpg'></nowiki></pre>

  • When a pop up window comes up it is - search bookmarks and history window! I cannot log into my bank as login button should open new window to log in but I get the search page. I cannot see larger images as again I get the search bookmarks and history pa

    When a pop up window comes up it is - search bookmarks and history window! I cannot log into my bank as login button should open new window to log in but I get the search page. I cannot see larger images as again I get the search bookmarks and history page etc. Happens on all options that should open new page. I am so frustrated, this has been happening since Firefox updated itself 2 days ago to Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET4.0C) was fine before that. using windows vista. Can you please advise what I should do? Also can you go back to previous version? Error console eg
    Warning: Error in parsing value for 'cursor'. Declaration dropped.
    Source File: https://ib.nab.com.au/nabib/styles/menu_nab.css?id=009
    Line: 116
    ib.nab.com.au : server does not support RFC 5746, see CVE-2009-3555 and Warning: Selector expected. Ruleset ignored due to bad selector.
    Source File: https://ib.nab.com.au/nabib/styles/nabstyle.css?id=014
    Line: 837
    == This happened ==
    Every time Firefox opened
    == 2 days ago after update.

    Do you have that problem when running in the Firefox SafeMode?
    [http://support.mozilla.com/en-US/kb/Safe+Mode]
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this:
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • Unable to create records in database using PHP Data Service

    Hello, I've been stuck on this for a few days and search up and down for this on the net, no response I've found has worked, so I come to you...
    Here are the steps I've taken, I think it's pretty standard
    1. I have a macbook pro running osx 10.7.3
    2. I installed MAMP all default (I've acually reinstalled this because someone suggested this might fix it)
    3. Thru phpMyAdmin I created a database called my_test
    4. In that database I created a table, this is the export of that table: (I've also tried this with InnoDB which is the default)
    CREATE TABLE `customer` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `name` varchar(50) NOT NULL,
      `email` varchar(150) NOT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `id` (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    5. I created a new Flx Project (Running Flash Builder 4.5.1 Premium)
         Project Name: PHPTest
         Application Type: Desktop (Although I've done the same thing with Web and got the same results)
         >> Next
         Application Server Type: PHP
         Web Root: /Applications/MAMP/htdocs/
         URL Root: http://localhost:8888/
         Clicked 'Validate Configuration' and that worked
         Output Folder: /Applications/MAMP/htdocs/PHPService (default by Flash Builder)
         >> Finished
    6. On the Data/Services tab on the bottom I click 'Connect to Data/Service...'
         Select 'PHP'
         >> Next
         Select 'Click here to generate a sample'
         Select 'Generate from database' radio button
         Username: root
         Password: root (default for MAMP)
         Host name: localhost
         Server port: 8889 (default for MAMP MySQL port, the HTTP port default is 8888 which in both cases seem to work but every video I've seen that uses MAMP on youtube uses 8889)
         Database: my_test
         Click 'Test Connection' (works)
         Table: customer
         Primary Key: id (this field is greyed out and Flash Builder selects 'id' which it figures out from the SQL table)
         >> Click OK
    7. Then if I don't have the Zend Framework folder in my /Applications/MAMP/htdocs/ folder it tells me its going to create that and I say alright. Then Flash Builder says stuff about how this is really only for testing and not production server ready and I say alright.
    8. Then it takes me back to the Form from Step 6 when I get the chance to select 'Click here to generate a sample'
         These fields are now filled with this data automaticly:
         PHP Class: /Applications/MAMP/htdocs/PHPTest/services/CustomerService.php
         Service name: CustomerService
         Service package: services.customerservice
         Data type package: valueObjects
         >> Click Next (shows all the functions that will be now availible)
         >> Click Finished (End of the forms and it opens Dreamweaver to the php file it created CustomerService.php which I have no need to edit so I close that down)
    9. Back in Flash Builder I switch to design view and drag a datagrid onto the big white area in the middle, whatever that is called.
    10. Then below in Data/Services tab on the bottom I click drag the function 'GetAllCustomer' on top of the datagrid.
         I say yes to rebound and click ok and the view of the datagrid is updated with the colums from the 'customer' table in mySQL.
    (Now let me say that when I hit save and compile this, if I actually had records in this table that I insert thru phpMyAdmin, this does show in the datagrid. So for the whole CRUD thing I am able to get the R which is Read)
    11. Now going back to the design view in Flash Builder I will create a form to create records in the table... (I guess this isn't really a step)
    12. In the Data/Service tab on the bottom I select 'createCustomer' function and then there is an icon called 'Generate Form' that looks like a white piece of paper with a gear on the bottom of it.
    13. This opens up a new form and since I don't have a crazy bunch of fields in my table I just click Finished (If you click next you can specify which fields you want to exclude from the form but this time I don't need to)
    14. This actually creates 2 forms if you look at the code, the second just shows the return type from when you click 'CreateCustomer' button on the first form. Because they overlap in design view I drag the form out of the way so you can see the input form, the return form, and the datagrid
    15. Then I save and compile...
    (Also if your actually reading this I didn't remove the id form field, I get the same result either way, but if you do remove the form field in the code/design you also have to update the button function to not deal with the id before it gets sent off to the php page since in this case the MySQL table is set to auto_increment the id, sorry this doesn't make much sence but this little area doesn't matter much either way)
    16. Now fill in whatever data you want for name and email, try differnt numbers in the id field like 0, nothing, 1, 1000 and click 'CreateCustomer'
    (For me nothing happens, no return is put in the return field, no error pops up and the datagrid is not updated with the new record, also going over to phpMyAdmin and checking out the table browse doesn't show any changes either, I know the button is calling the function because if I add a state change in that function it changes, it would seem that the line:
    createCustomerResult.token = customerService.createCustomer(customer2); doesn't do anything)
    So any idea what is wrong here, I'm convenced it's something stupid easy simple I just can't see it.

    In case you need more info, here is a code dump on a mxml project that has this problem:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           xmlns:customerservice="services.customerservice.*"
                           xmlns:valueObjects="valueObjects.*"
                           currentState="State1">
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getAllCustomerResult.token = customerService.getAllCustomer();
                protected function button_clickHandler(event:MouseEvent):void
                    var customer2:Customer = new Customer();
                    customer2.id = parseInt(idTextInput.text);
                    customer2.name = nameTextInput.text;
                    customer2.email = emailTextInput.text;
                    currentState = "Test";
                    createCustomerResult.token = customerService.createCustomer(customer2);
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="State1"/>
            <s:State name="Test"/>
        </s:states>
        <fx:Declarations>
            <s:CallResponder id="getAllCustomerResult"/>
            <customerservice:CustomerService id="customerService"
                                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                             showBusyCursor="true"/>
            <valueObjects:Customer id="customer"/>
            <s:CallResponder id="createCustomerResult"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:DataGrid id="dataGrid" includeIn="State1" x="330" y="10" width="392"
                    creationComplete="dataGrid_creationCompleteHandler(event)" requestedRowCount="4">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                    <s:GridColumn dataField="name" headerText="name"></s:GridColumn>
                    <s:GridColumn dataField="email" headerText="email"></s:GridColumn>
                </s:ArrayList>
            </s:columns>
            <s:typicalItem>
                <fx:Object id="id1" email="email1" name="name1"></fx:Object>
            </s:typicalItem>
            <s:AsyncListView list="{getAllCustomerResult.lastResult}"/>
        </s:DataGrid>
        <s:Form includeIn="State1" defaultButton="{button}">
            <s:FormItem label="Id">
                <s:TextInput id="idTextInput" text="{customer.id}"/>
            </s:FormItem>
            <s:FormItem label="Name">
                <s:TextInput id="nameTextInput" text="{customer.name}"/>
            </s:FormItem>
            <s:FormItem label="Email">
                <s:TextInput id="emailTextInput" text="{customer.email}"/>
            </s:FormItem>
            <s:Button id="button" label="CreateCustomer" click="button_clickHandler(event)"/>
        </s:Form>
        <s:Form includeIn="State1" x="0" y="204">
            <s:FormItem label="CreateCustomer">
                <s:TextInput id="createCustomerTextInput" text="{createCustomerResult.lastResult as int}"/>
            </s:FormItem>
        </s:Form>
    </s:WindowedApplication>

  • Best way to update images using PHP / MySQL?

    HI
    I want to update images using PHP/MySQL, so users can update their images and maybe some other files but mainly images.
    thanks

    How messed up is this code?!
    <?php
    //connect to database
    $con = mysql_connect("testhost","testuser","pass");
    // file properies
    $file = $_FILES['image']['tmp_name'];
    if (!isset($file))
    echo "please select an image";
    else {
        $id = $_REQUEST['id_display'];
        $image = ($_FILES['image']['tmp_name']) ? file_get_contents ($_FILES['image']['tmp_name']) : '';
        $image_name = ($_FILES['image']['name']) ? addslashes($_FILES['image']['name']): '';
        $image_size = ($_FILES['image']['tmp_name']) ? getimagesize($_FILES['image']['tmp_name']): '';
        if ($image_size == FALSE)
        echo "You have not selected an image.";
        else {
            mysql_select_db("test_display", $con);
            mysql_query("UPDATE testtable SET image = '$image', imagename = '$image_name' WHERE id_display='$id'");
    ?>
    And the upload page....
    /*Update code */ /*End update code */                            

  • Using PHP to display semi-random images?

    Hello,
    I'm looking for help using PHP and MySQL to generate semi-random images on my web site. Here's what I'm trying to do: I have 60 images, but I only want to display 16 at a time (for examlpe http://artisdead.net/antelopegardens.php).
    The way I imagine this is, the design has 16 image placeholders. I want Placeholder 1 (the first image) to randomally pull record ID 1, 2, or 3 from the SQL database, while Placeholder 2 pulls record ID 4-6, etc. It's important that one of the first 3 images displays first, while one of the second 3 images displays next, etc.
    I've found various ways to randomize all the images, but I'm not understanding how to constrain the randomization the way I'm looking to. Any help would be greatly appreciated. Thanks in advance.

    Alamo_Melt wrote:
     The way I imagine this is, the design has 16 image placeholders. I want Placeholder 1 (the first image) to randomally pull record ID 1, 2, or 3 from the SQL database, while Placeholder 2 pulls record ID 4-6, etc. It's important that one of the first 3 images displays first, while one of the second 3 images displays next, etc.
    Before offering a possible solution, I should point out that your plan has a minor flaw. If you display only 16 images, and want the random choice to come from incremental sets of three, the maximum number you can have in your set is 48. The final 12 images will never be selected. For 60 images, you need 20 placeholders. The alternative is to have a total set of 64 images, and make the random choice come from incremental sets of four images.
    With that caveat, here's how I would do it. The primary keys of your records might not be consecutive, particularly if records are deleted and new ones added, so it might be a good idea to have a separate column with consecutive numbers from 1 to the the maximum. To select random numbers from incremental groups of three, use the following:
    $id = array();
    $min = 1;
    $max = 3;
    for ($i = 0; $i < 16; $i++) {
      // generate random number from current set
      $id[$i] = mt_rand($min, $max);
      // increment the minimum and maximum numbers for the next set
      $min += 3;
      $max += 3;
    // join the selected values as a comma-separated string
    $vals = implode(',', $id);
    $sql = "SELECT image FROM images WHERE id IN ($vals)";
    // excecute the SQL query

  • How use PHP to read image files from a folder and display them in Flex 3 tilelist.

    Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
    PHP :
    PHP Code:
    <?php
    //Open images directory
    $imglist = '';
    $dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "filename: " . $file . "\n";
    $dir->close();
    ?>
    FLEX 3 :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.rpc.events.ResultEvent;
    public var image:Object;
    private function resultHandler(event:ResultEvent):void
    image = (event.result);
    ta1.text = String(event.result);
    private function faultHandler(event:FaultEvent):void
    ta1.text = "Fault Response from HTTPService call:\n ";
    ]]>
    </mx:Script>
    <mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
    <mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
    <mx:HTTPService id="pic" url="{phpPicture}" method="POST"
    result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
    <mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
    <mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
    </mx:Application>
    Thanks. Need help as soon as possbile. URGENT.

    i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
    PHP Code:
    <?php
    echo '<?xml version="1.0" encoding="utf-8"?>';
    ?>
    <root>
    <images>
    <?php
    //Open images directory
    $dir = dir("images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
    //$dir->close();
    ?>
    </images>
    </root>
    Flex Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="callPHP();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.http.HTTPService;
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var arr:ArrayCollection = new ArrayCollection();
    private function callPHP():void
    var hs:HTTPService = new HTTPService();
    hs.url = 'Picture.php';
    hs.addEventListener( ResultEvent.RESULT, resultHandler );
    hs.addEventListener( FaultEvent.FAULT, faultHandler )
    hs.send();
    private function resultHandler( event:ResultEvent ):void
    arr = event.result.root.images.image as ArrayCollection;
    private function faultHandler( event:FaultEvent ):void
    Alert.show( "Fault Response from HTTPService call:\n " );
    ]]>
    </mx:Script>
    <mx:TileList id="tilelist"
    dataProvider="{arr}">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Image source="images/{data}" />
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

Maybe you are looking for

  • How can I open an email file in edition mode?

    Hi! I use a system here in my company that generates an automatic email and prepare it to be sent. We were using MS Outlook and we have migrated to thunderbird for lots of reasons. But since it has migrated, the system cannot generate this email in t

  • How can I use footage shot with a phone app?

    I have shot footage on my phone using a filtered app called Majicam.  When I play it in premiere it plays as a green screen. Do I need to alter something about the footage in order for Premiere to recognise it? Please help.

  • Top sites background color in 6.1

    So this is my third try to post this question today.  It kept getting deleted because the moderators said it was an "unreleased product" when it was not.  Now that I see many other posts about 6.1, hopefully they don't delete me for a third time. Dis

  • Newly installed Acrobat will NOT open from Creative Cloud app on Desktop using Windows 7 Pro - what's the problem?

    Newly installed Acrobat will NOT open from Creative Cloud app on Desktop using Windows 7 Pro - what's the problem?

  • I want to move my CS5 to a new computer

    I have my purchased copy of CS5 from a couple years ago, which I downloaded. My laptop is getting kind of tired, so thinking about upgrading to something new. I need to know if and how I can move my CS5 over to the new computer. Happy to delicence th