Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7640787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:45:26+00:00 2026-05-31T08:45:26+00:00

I have no idea how to do this. I want to insert php code

  • 0

I have no idea how to do this. I want to insert php code into an image source through jquery.. but it is not working. Here is my code and help would be greatly appreciated!

JQUERY:

var mainId = $(this).attr('id');
$("#intabdiv img").attr('src', '<?=resize("../php/admin/portfolio/before/'+mainId+'",$settings)?>' );

HTML:

<div id="intabdiv">
<?php $settings = array('w'=>450,'h'=>450,'crop'=>true); ?>
              <img src="" border="0" class="pic" />
          </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:45:27+00:00Added an answer on May 31, 2026 at 8:45 am

    It looks to me like you’re trying to have the client browser execute PHP. That’s not going to work for you. I’m not sure you have a completely clear idea of the separation between server and client, and what happens where.

    Here’s a simple model that you can use to think about where things occur:

    1. User puts URL in browser and hits enter
    2. Browser sends request to server
    3. Server receives request and attempts to provide the resource requested
    4. At this stage, if the file is a PHP file, any PHP instructions are executed. The end result of this, after all PHP is finished and done, is an HTML file, perhaps with some javascript.
    5. The server sends this HTML file back to the browser.
    6. The browser loads the HTML file, and executes any javascript, which can manipulate the HTML on the client side.

    So, where does that leave us? You’re attempting to take an image file that exists on the server, resize it, and display it to the end user. Presumably the “resize” function is one you have defined somewhere in your PHP code. I’ll go on the assumption that you just need to do this once and have it show up for the user when the page loads.

    In this case, what you need to do is something more like the following (all in the same file):

    <?php
    $settings = array('w'=>450,'h'=>450,'crop'=>true);
    $imgsrc = resize("../php/admin/portfolio/before/imageid.jpg",$settings);
    ?>
    <div id="intabdiv">
        <img src="<?= $imgsrc; ?>" border="0" class="pic" />
    </div>
    

    … no javascript required. Obviously, imageid.jpg must be the actual filename of the image you’re trying to access. If, instead, you’re trying to have some user action trigger the access to the image, please provide more context for what you’re trying to accomplish and a better answer can be given.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea what this means. But here is the code that it
I have absolutely no idea why this is happening but the following code seems
I have no idea why this isn't working. I've taken code from a previous
I have no idea why this is happening. I have some very straightforward code,
I have no idea if this is possible, but if it is, what would
I have no idea why this doesn't work, but doing some validation functions and
I have no idea if this is possible ... but it would be cool.
I have no idea how this works or if it is even possible but
Does anyone have any idea what this jQuery selector will do? object.find('td:eq(1) div div');
In php I have an INSERT query to database. This query add some issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.